diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-08-03 19:26:54 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-08-03 19:26:54 +0200 |
commit | 4f5b44bd3bd490309eb2ba7b44df4769816ba729 (patch) | |
tree | 6cefe170dfe0a5a361cb1e2d1fc4d580a3316d02 /vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/TestExtension.php | |
parent | 2b840e0cfb63a453bea67a98541f3df9c273c5f5 (diff) | |
download | wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.gz wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.zst wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.zip |
twig implementation
Diffstat (limited to 'vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/TestExtension.php')
-rw-r--r-- | vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/TestExtension.php | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/TestExtension.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/TestExtension.php new file mode 100644 index 00000000..f9de560f --- /dev/null +++ b/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/TestExtension.php | |||
@@ -0,0 +1,72 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Form\Tests\Fixtures; | ||
13 | |||
14 | use Symfony\Component\Form\FormTypeInterface; | ||
15 | use Symfony\Component\Form\FormTypeExtensionInterface; | ||
16 | use Symfony\Component\Form\FormTypeGuesserInterface; | ||
17 | use Symfony\Component\Form\FormExtensionInterface; | ||
18 | |||
19 | class TestExtension implements FormExtensionInterface | ||
20 | { | ||
21 | private $types = array(); | ||
22 | |||
23 | private $extensions = array(); | ||
24 | |||
25 | private $guesser; | ||
26 | |||
27 | public function __construct(FormTypeGuesserInterface $guesser) | ||
28 | { | ||
29 | $this->guesser = $guesser; | ||
30 | } | ||
31 | |||
32 | public function addType(FormTypeInterface $type) | ||
33 | { | ||
34 | $this->types[$type->getName()] = $type; | ||
35 | } | ||
36 | |||
37 | public function getType($name) | ||
38 | { | ||
39 | return isset($this->types[$name]) ? $this->types[$name] : null; | ||
40 | } | ||
41 | |||
42 | public function hasType($name) | ||
43 | { | ||
44 | return isset($this->types[$name]); | ||
45 | } | ||
46 | |||
47 | public function addTypeExtension(FormTypeExtensionInterface $extension) | ||
48 | { | ||
49 | $type = $extension->getExtendedType(); | ||
50 | |||
51 | if (!isset($this->extensions[$type])) { | ||
52 | $this->extensions[$type] = array(); | ||
53 | } | ||
54 | |||
55 | $this->extensions[$type][] = $extension; | ||
56 | } | ||
57 | |||
58 | public function getTypeExtensions($name) | ||
59 | { | ||
60 | return isset($this->extensions[$name]) ? $this->extensions[$name] : array(); | ||
61 | } | ||
62 | |||
63 | public function hasTypeExtensions($name) | ||
64 | { | ||
65 | return isset($this->extensions[$name]); | ||
66 | } | ||
67 | |||
68 | public function getTypeGuesser() | ||
69 | { | ||
70 | return $this->guesser; | ||
71 | } | ||
72 | } | ||