Skip to content
This repository
Browse code

[Annotations] Introduce doctrine/annotations dependency

  • Loading branch information...
commit 185e6d76765fe37ddb1a94aad8f51d97c92b0649 1 parent 9fdc9f4
Benjamin Eberlei authored January 12, 2013

Showing 88 changed files with 70 additions and 9,548 deletions. Show diff stats Hide diff stats

  1. 3  composer.json
  2. 69  composer.lock
  3. 79  lib/Doctrine/Common/Annotations/Annotation.php
  4. 47  lib/Doctrine/Common/Annotations/Annotation/Attribute.php
  5. 37  lib/Doctrine/Common/Annotations/Annotation/Attributes.php
  6. 85  lib/Doctrine/Common/Annotations/Annotation/Enum.php
  7. 54  lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php
  8. 33  lib/Doctrine/Common/Annotations/Annotation/Required.php
  9. 107  lib/Doctrine/Common/Annotations/Annotation/Target.php
  10. 150  lib/Doctrine/Common/Annotations/AnnotationException.php
  11. 310  lib/Doctrine/Common/Annotations/AnnotationReader.php
  12. 139  lib/Doctrine/Common/Annotations/AnnotationRegistry.php
  13. 250  lib/Doctrine/Common/Annotations/CachedReader.php
  14. 132  lib/Doctrine/Common/Annotations/DocLexer.php
  15. 1,041  lib/Doctrine/Common/Annotations/DocParser.php
  16. 269  lib/Doctrine/Common/Annotations/FileCacheReader.php
  17. 141  lib/Doctrine/Common/Annotations/IndexedReader.php
  18. 89  lib/Doctrine/Common/Annotations/PhpParser.php
  19. 67  lib/Doctrine/Common/Annotations/Reader.php
  20. 157  lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php
  21. 175  lib/Doctrine/Common/Annotations/TokenParser.php
  22. 582  tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php
  23. 13  tests/Doctrine/Tests/Common/Annotations/AnnotationReaderTest.php
  24. 56  tests/Doctrine/Tests/Common/Annotations/CachedReaderTest.php
  25. 137  tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php
  26. 1,264  tests/Doctrine/Tests/Common/Annotations/DocParserTest.php
  27. 48  tests/Doctrine/Tests/Common/Annotations/DummyClass.php
  28. 40  tests/Doctrine/Tests/Common/Annotations/FileCacheReaderTest.php
  29. 10  tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/AnnotWithDefaultValue.php
  30. 10  tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Autoload.php
  31. 11  tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Route.php
  32. 18  tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Secure.php
  33. 14  tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Template.php
  34. 11  tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Version.php
  35. 21  tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationEnum.php
  36. 17  tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationEnumInvalid.php
  37. 34  tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationEnumLiteral.php
  38. 31  tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationEnumLiteralInvalid.php
  39. 14  tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationTargetAll.php
  40. 14  tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationTargetAnnotation.php
  41. 15  tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationTargetClass.php
  42. 15  tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationTargetMethod.php
  43. 14  tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationTargetPropertyMethod.php
  44. 119  tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationWithAttributes.php
  45. 20  tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationWithConstants.php
  46. 50  tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationWithRequiredAttributes.php
  47. 24  tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationWithRequiredAttributesWithoutContructor.php
  48. 11  tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationWithTargetSyntaxError.php
  49. 62  tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationWithVarType.php
  50. 10  tests/Doctrine/Tests/Common/Annotations/Fixtures/Api.php
  51. 30  tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassDDC1660.php
  52. 29  tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithAnnotationEnum.php
  53. 21  tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithAnnotationWithTargetSyntaxError.php
  54. 31  tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithAnnotationWithVarType.php
  55. 52  tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithClosure.php
  56. 10  tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithConstants.php
  57. 11  tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithFullyQualifiedUseStatements.php
  58. 17  tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithInvalidAnnotationTargetAtClass.php
  59. 20  tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithInvalidAnnotationTargetAtMethod.php
  60. 24  tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithInvalidAnnotationTargetAtProperty.php
  61. 15  tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithRequire.php
  62. 41  tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithValidAnnotationTarget.php
  63. 300  tests/Doctrine/Tests/Common/Annotations/Fixtures/Controller.php
  64. 15  tests/Doctrine/Tests/Common/Annotations/Fixtures/DifferentNamespacesPerFileWithClassAsFirst.php
  65. 15  tests/Doctrine/Tests/Common/Annotations/Fixtures/DifferentNamespacesPerFileWithClassAsLast.php
  66. 13  tests/Doctrine/Tests/Common/Annotations/Fixtures/EqualNamespacesPerFileWithClassAsFirst.php
  67. 12  tests/Doctrine/Tests/Common/Annotations/Fixtures/EqualNamespacesPerFileWithClassAsLast.php
  68. 12  tests/Doctrine/Tests/Common/Annotations/Fixtures/GlobalNamespacesPerFileWithClassAsFirst.php
  69. 12  tests/Doctrine/Tests/Common/Annotations/Fixtures/GlobalNamespacesPerFileWithClassAsLast.php
  70. 10  tests/Doctrine/Tests/Common/Annotations/Fixtures/IntefaceWithConstants.php
  71. 14  tests/Doctrine/Tests/Common/Annotations/Fixtures/InvalidAnnotationUsageButIgnoredClass.php
  72. 10  tests/Doctrine/Tests/Common/Annotations/Fixtures/InvalidAnnotationUsageClass.php
  73. 9  tests/Doctrine/Tests/Common/Annotations/Fixtures/MultipleClassesInFile.php
  74. 10  tests/Doctrine/Tests/Common/Annotations/Fixtures/MultipleImportsInUseStatement.php
  75. 20  tests/Doctrine/Tests/Common/Annotations/Fixtures/NamespaceAndClassCommentedOut.php
  76. 12  tests/Doctrine/Tests/Common/Annotations/Fixtures/NamespaceWithClosureDeclaration.php
  77. 1,009  tests/Doctrine/Tests/Common/Annotations/Fixtures/NamespacedSingleClassLOC1000.php
  78. 5  tests/Doctrine/Tests/Common/Annotations/Fixtures/NoAnnotation.php
  79. 10  tests/Doctrine/Tests/Common/Annotations/Fixtures/NonNamespacedClass.php
  80. 1,006  tests/Doctrine/Tests/Common/Annotations/Fixtures/SingleClassLOC1000.php
  81. 13  tests/Doctrine/Tests/Common/Annotations/Fixtures/TestInterface.php
  82. 194  tests/Doctrine/Tests/Common/Annotations/PerformanceTest.php
  83. 207  tests/Doctrine/Tests/Common/Annotations/PhpParserTest.php
  84. 97  tests/Doctrine/Tests/Common/Annotations/SimpleAnnotationReaderTest.php
  85. 65  tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM55Test.php
  86. 8  tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM58Entity.php
  87. 112  tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM58Test.php
  88. 8  tests/Doctrine/Tests/Common/Annotations/TopLevelAnnotation.php
3  composer.json
@@ -17,7 +17,8 @@
17 17
         "doctrine/inflector": "1.*",
18 18
         "doctrine/cache": "1.*",
19 19
         "doctrine/collections": "1.*",
20  
-        "doctrine/lexer": "1.*"
  20
+        "doctrine/lexer": "1.*",
  21
+        "doctrine/annotations": "1.*"
21 22
     },
22 23
     "autoload": {
23 24
         "psr-0": { "Doctrine\\Common\\": "lib/" }
69  composer.lock
... ...
@@ -1,7 +1,74 @@
1 1
 {
2  
-    "hash": "6a054681ff53691d1a67dacd590b3c33",
  2
+    "hash": "f763db6a8f5bcaff6e51ae516283a4c9",
3 3
     "packages": [
4 4
         {
  5
+            "name": "doctrine/annotations",
  6
+            "version": "v1.0",
  7
+            "source": {
  8
+                "type": "git",
  9
+                "url": "https://github.com/doctrine/annotations.git",
  10
+                "reference": "v1.0"
  11
+            },
  12
+            "dist": {
  13
+                "type": "zip",
  14
+                "url": "https://github.com/doctrine/annotations/archive/v1.0.zip",
  15
+                "reference": "v1.0",
  16
+                "shasum": ""
  17
+            },
  18
+            "require": {
  19
+                "php": ">=5.3.2",
  20
+                "doctrine/lexer": "1.*"
  21
+            },
  22
+            "require-dev": {
  23
+                "doctrine/cache": "1.*"
  24
+            },
  25
+            "time": "2013-01-12 19:23:32",
  26
+            "type": "library",
  27
+            "installation-source": "dist",
  28
+            "autoload": {
  29
+                "psr-0": {
  30
+                    "Doctrine\\Common\\Annotations\\": "lib/"
  31
+                }
  32
+            },
  33
+            "notification-url": "https://packagist.org/downloads/",
  34
+            "license": [
  35
+                "MIT"
  36
+            ],
  37
+            "authors": [
  38
+                {
  39
+                    "name": "Jonathan Wage",
  40
+                    "email": "jonwage@gmail.com",
  41
+                    "homepage": "http://www.jwage.com/"
  42
+                },
  43
+                {
  44
+                    "name": "Guilherme Blanco",
  45
+                    "email": "guilhermeblanco@gmail.com",
  46
+                    "homepage": "http://www.instaclick.com"
  47
+                },
  48
+                {
  49
+                    "name": "Roman Borschel",
  50
+                    "email": "roman@code-factory.org"
  51
+                },
  52
+                {
  53
+                    "name": "Benjamin Eberlei",
  54
+                    "email": "kontakt@beberlei.de"
  55
+                },
  56
+                {
  57
+                    "name": "Johannes Schmitt",
  58
+                    "email": "schmittjoh@gmail.com",
  59
+                    "homepage": "https://github.com/schmittjoh",
  60
+                    "role": "Developer of wrapped JMSSerializerBundle"
  61
+                }
  62
+            ],
  63
+            "description": "Docblock Annotations Parser",
  64
+            "homepage": "http://www.doctrine-project.org",
  65
+            "keywords": [
  66
+                "annotations",
  67
+                "parser",
  68
+                "docblock"
  69
+            ]
  70
+        },
  71
+        {
5 72
             "name": "doctrine/cache",
6 73
             "version": "v1.0",
7 74
             "source": {
79  lib/Doctrine/Common/Annotations/Annotation.php
... ...
@@ -1,79 +0,0 @@
1  
-<?php
2  
-/*
3  
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4  
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5  
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6  
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7  
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8  
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9  
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10  
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11  
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12  
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13  
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14  
- *
15  
- * This software consists of voluntary contributions made by many individuals
16  
- * and is licensed under the MIT license. For more information, see
17  
- * <http://www.doctrine-project.org>.
18  
- */
19  
-
20  
-namespace Doctrine\Common\Annotations;
21  
-
22  
-/**
23  
- * Annotations class
24  
- *
25  
- * @author  Benjamin Eberlei <kontakt@beberlei.de>
26  
- * @author  Guilherme Blanco <guilhermeblanco@hotmail.com>
27  
- * @author  Jonathan Wage <jonwage@gmail.com>
28  
- * @author  Roman Borschel <roman@code-factory.org>
29  
- */
30  
-class Annotation
31  
-{
32  
-    /**
33  
-     * Value property. Common among all derived classes.
34  
-     *
35  
-     * @var string
36  
-     */
37  
-    public $value;
38  
-
39  
-    /**
40  
-     * Constructor
41  
-     *
42  
-     * @param array $data Key-value for properties to be defined in this class
43  
-     */
44  
-    public final function __construct(array $data)
45  
-    {
46  
-        foreach ($data as $key => $value) {
47  
-            $this->$key = $value;
48  
-        }
49  
-    }
50  
-
51  
-    /**
52  
-     * Error handler for unknown property accessor in Annotation class.
53  
-     *
54  
-     * @param string $name Unknown property name
55  
-     *
56  
-     * @throws \BadMethodCallException
57  
-     */
58  
-    public function __get($name)
59  
-    {
60  
-        throw new \BadMethodCallException(
61  
-            sprintf("Unknown property '%s' on annotation '%s'.", $name, get_class($this))
62  
-        );
63  
-    }
64  
-
65  
-    /**
66  
-     * Error handler for unknown property mutator in Annotation class.
67  
-     *
68  
-     * @param string $name Unkown property name
69  
-     * @param mixed $value Property value
70  
-     *
71  
-     * @throws \BadMethodCallException
72  
-     */
73  
-    public function __set($name, $value)
74  
-    {
75  
-        throw new \BadMethodCallException(
76  
-            sprintf("Unknown property '%s' on annotation '%s'.", $name, get_class($this))
77  
-        );
78  
-    }
79  
-}
47  lib/Doctrine/Common/Annotations/Annotation/Attribute.php
... ...
@@ -1,47 +0,0 @@
1  
-<?php
2  
-
3  
-/*
4  
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5  
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6  
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7  
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8  
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9  
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10  
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11  
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12  
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13  
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14  
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15  
- *
16  
- * This software consists of voluntary contributions made by many individuals
17  
- * and is licensed under the MIT license. For more information, see
18  
- * <http://www.doctrine-project.org>.
19  
- */
20  
-
21  
-namespace Doctrine\Common\Annotations\Annotation;
22  
-
23  
-/**
24  
- * Annotation that can be used to signal to the parser
25  
- * to check the attribute type during the parsing process.
26  
- *
27  
- * @author Fabio B. Silva <fabio.bat.silva@gmail.com>
28  
- *
29  
- * @Annotation
30  
- */
31  
-final class Attribute
32  
-{
33  
-    /**
34  
-     * @var string
35  
-     */
36  
-    public $name;
37  
-
38  
-    /**
39  
-     * @var string
40  
-     */
41  
-    public $type;
42  
-
43  
-    /**
44  
-     * @var boolean
45  
-     */
46  
-    public $required = false;
47  
-}
37  lib/Doctrine/Common/Annotations/Annotation/Attributes.php
... ...
@@ -1,37 +0,0 @@
1  
-<?php
2  
-
3  
-/*
4  
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5  
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6  
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7  
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8  
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9  
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10  
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11  
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12  
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13  
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14  
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15  
- *
16  
- * This software consists of voluntary contributions made by many individuals
17  
- * and is licensed under the MIT license. For more information, see
18  
- * <http://www.doctrine-project.org>.
19  
- */
20  
-
21  
-namespace Doctrine\Common\Annotations\Annotation;
22  
-
23  
-/**
24  
- * Annotation that can be used to signal to the parser
25  
- * to check the types of all declared attributes during the parsing process.
26  
- *
27  
- * @author Fabio B. Silva <fabio.bat.silva@gmail.com>
28  
- *
29  
- * @Annotation
30  
- */
31  
-final class Attributes
32  
-{
33  
-    /**
34  
-     * @var array<Doctrine\Common\Annotations\Annotation\Attribute>
35  
-     */
36  
-    public $value;
37  
-}
85  lib/Doctrine/Common/Annotations/Annotation/Enum.php
... ...
@@ -1,85 +0,0 @@
1  
-<?php
2  
-
3  
-/*
4  
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5  
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6  
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7  
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8  
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9  
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10  
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11  
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12  
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13  
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14  
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15  
- *
16  
- * This software consists of voluntary contributions made by many individuals
17  
- * and is licensed under the MIT license. For more information, see
18  
- * <http://www.doctrine-project.org>.
19  
- */
20  
-
21  
-namespace Doctrine\Common\Annotations\Annotation;
22  
-
23  
-/**
24  
- * Annotation that can be used to signal to the parser
25  
- * to check the available values during the parsing process.
26  
- *
27  
- * @since  2.4
28  
- * @author Fabio B. Silva <fabio.bat.silva@gmail.com>
29  
- *
30  
- * @Annotation
31  
- * @Attributes({
32  
- *    @Attribute("value",   required = true,  type = "array"),
33  
- *    @Attribute("literal", required = false, type = "array")
34  
- * })
35  
- */
36  
-final class Enum
37  
-{
38  
-    /**
39  
-     * @var array
40  
-     */
41  
-    public $value;
42  
-
43  
-    /**
44  
-     * Literal target declaration.
45  
-     *
46  
-     * @var array
47  
-     */
48  
-    public $literal;
49  
-
50  
-    /**
51  
-     * Annotation construct
52  
-     *
53  
-     * @param array $values
54  
-     *
55  
-     * @throws \InvalidArgumentException
56  
-     */
57  
-    public function __construct(array $values)
58  
-    {
59  
-        if ( ! isset($values['literal'])) {
60  
-            $values['literal'] = array();
61  
-        }
62  
-
63  
-        foreach ($values['value'] as $var) {
64  
-            if( ! is_scalar($var)) {
65  
-                throw new \InvalidArgumentException(sprintf(
66  
-                    '@Enum supports only scalar values "%s" given.',
67  
-                    is_object($var) ? get_class($var) : gettype($var)
68  
-                ));
69  
-            }
70  
-        }
71  
-
72  
-        foreach ($values['literal'] as $key => $var) {
73  
-            if( ! in_array($key, $values['value'])) {
74  
-                throw new \InvalidArgumentException(sprintf(
75  
-                    'Undefined enumerator value "%s" for literal "%s".',
76  
-                    $key , $var
77  
-                ));
78  
-            }
79  
-        }
80  
-
81  
-        $this->value    = $values['value'];
82  
-        $this->literal  = $values['literal'];
83  
-    }
84  
-
85  
-}
54  lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php
... ...
@@ -1,54 +0,0 @@
1  
-<?php
2  
-/*
3  
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4  
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5  
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6  
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7  
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8  
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9  
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10  
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11  
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12  
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13  
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14  
- *
15  
- * This software consists of voluntary contributions made by many individuals
16  
- * and is licensed under the MIT license. For more information, see
17  
- * <http://www.doctrine-project.org>.
18  
- */
19  
-
20  
-namespace Doctrine\Common\Annotations\Annotation;
21  
-
22  
-/**
23  
- * Annotation that can be used to signal to the parser to ignore specific
24  
- * annotations during the parsing process.
25  
- *
26  
- * @Annotation
27  
- * @author Johannes M. Schmitt <schmittjoh@gmail.com>
28  
- */
29  
-final class IgnoreAnnotation
30  
-{
31  
-    /**
32  
-     * @var array
33  
-     */
34  
-    public $names;
35  
-
36  
-    /**
37  
-     * Constructor
38  
-     *
39  
-     * @param array $values
40  
-     *
41  
-     * @throws \RuntimeException
42  
-     */
43  
-    public function __construct(array $values)
44  
-    {
45  
-        if (is_string($values['value'])) {
46  
-            $values['value'] = array($values['value']);
47  
-        }
48  
-        if (!is_array($values['value'])) {
49  
-            throw new \RuntimeException(sprintf('@IgnoreAnnotation expects either a string name, or an array of strings, but got %s.', json_encode($values['value'])));
50  
-        }
51  
-
52  
-        $this->names = $values['value'];
53  
-    }
54  
-}
33  lib/Doctrine/Common/Annotations/Annotation/Required.php
... ...
@@ -1,33 +0,0 @@
1  
-<?php
2  
-
3  
-/*
4  
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5  
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6  
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7  
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8  
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9  
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10  
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11  
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12  
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13  
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14  
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15  
- *
16  
- * This software consists of voluntary contributions made by many individuals
17  
- * and is licensed under the MIT license. For more information, see
18  
- * <http://www.doctrine-project.org>.
19  
- */
20  
-
21  
-namespace Doctrine\Common\Annotations\Annotation;
22  
-
23  
-/**
24  
- * Annotation that can be used to signal to the parser
25  
- * to check if that attribute is required during the parsing process.
26  
- *
27  
- * @author Fabio B. Silva <fabio.bat.silva@gmail.com>
28  
- *
29  
- * @Annotation
30  
- */
31  
-final class Required
32  
-{
33  
-}
107  lib/Doctrine/Common/Annotations/Annotation/Target.php
... ...
@@ -1,107 +0,0 @@
1  
-<?php
2  
-
3  
-/*
4  
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5  
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6  
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7  
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8  
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9  
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10  
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11  
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12  
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13  
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14  
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15  
- *
16  
- * This software consists of voluntary contributions made by many individuals
17  
- * and is licensed under the MIT license. For more information, see
18  
- * <http://www.doctrine-project.org>.
19  
- */
20  
-
21  
-namespace Doctrine\Common\Annotations\Annotation;
22  
-
23  
-/**
24  
- * Annotation that can be used to signal to the parser
25  
- * to check the annotation target during the parsing process.
26  
- *
27  
- * @author Fabio B. Silva <fabio.bat.silva@gmail.com>
28  
- *
29  
- * @Annotation
30  
- */
31  
-final class Target
32  
-{
33  
-    const TARGET_CLASS              = 1;
34  
-    const TARGET_METHOD             = 2;
35  
-    const TARGET_PROPERTY           = 4;
36  
-    const TARGET_ANNOTATION         = 8;
37  
-    const TARGET_ALL                = 15;
38  
-
39  
-    /**
40  
-     * @var array
41  
-     */
42  
-    private static $map = array(
43  
-        'ALL'         => self::TARGET_ALL,
44  
-        'CLASS'       => self::TARGET_CLASS,
45  
-        'METHOD'      => self::TARGET_METHOD,
46  
-        'PROPERTY'    => self::TARGET_PROPERTY,
47  
-        'ANNOTATION'  => self::TARGET_ANNOTATION,
48  
-    );
49  
-
50  
-    /**
51  
-     * @var array
52  
-     */
53  
-    public $value;
54  
-
55  
-    /**
56  
-     * Targets as bitmask.
57  
-     *
58  
-     * @var integer
59  
-     */
60  
-    public $targets;
61  
-
62  
-    /**
63  
-     * Literal target declaration.
64  
-     *
65  
-     * @var integer
66  
-     */
67  
-    public $literal;
68  
-
69  
-    /**
70  
-     * Annotation construct
71  
-     *
72  
-     * @param array $values
73  
-     *
74  
-     * @throws \InvalidArgumentException
75  
-     */
76  
-    public function __construct(array $values)
77  
-    {
78  
-        if (!isset($values['value'])){
79  
-            $values['value'] = null;
80  
-        }
81  
-        if (is_string($values['value'])){
82  
-            $values['value'] = array($values['value']);
83  
-        }
84  
-        if (!is_array($values['value'])){
85  
-            throw new \InvalidArgumentException(
86  
-                sprintf('@Target expects either a string value, or an array of strings, "%s" given.',
87  
-                    is_object($values['value']) ? get_class($values['value']) : gettype($values['value'])
88  
-                )
89  
-            );
90  
-        }
91  
-
92  
-        $bitmask = 0;
93  
-        foreach ($values['value'] as $literal) {
94  
-            if(!isset(self::$map[$literal])){
95  
-                throw new \InvalidArgumentException(
96  
-                    sprintf('Invalid Target "%s". Available targets: [%s]',
97  
-                            $literal,  implode(', ', array_keys(self::$map)))
98  
-                );
99  
-            }
100  
-            $bitmask += self::$map[$literal];
101  
-        }
102  
-
103  
-        $this->targets  = $bitmask;
104  
-        $this->value    = $values['value'];
105  
-        $this->literal  = implode(', ', $this->value);
106  
-    }
107  
-}
150  lib/Doctrine/Common/Annotations/AnnotationException.php
... ...
@@ -1,150 +0,0 @@
1  
-<?php
2  
-/*
3  
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4  
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5  
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6  
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7  
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8  
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9  
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10  
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11  
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12  
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13  
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14  
- *
15  
- * This software consists of voluntary contributions made by many individuals
16  
- * and is licensed under the MIT license. For more information, see
17  
- * <http://www.doctrine-project.org>.
18  
- */
19  
-
20  
-namespace Doctrine\Common\Annotations;
21  
-
22  
-/**
23  
- * Description of AnnotationException
24  
- *
25  
- * @since   2.0
26  
- * @author  Benjamin Eberlei <kontakt@beberlei.de>
27  
- * @author  Guilherme Blanco <guilhermeblanco@hotmail.com>
28  
- * @author  Jonathan Wage <jonwage@gmail.com>
29  
- * @author  Roman Borschel <roman@code-factory.org>
30  
- */
31  
-class AnnotationException extends \Exception
32  
-{
33  
-    /**
34  
-     * Creates a new AnnotationException describing a Syntax error.
35  
-     *
36  
-     * @param string $message Exception message
37  
-     * @return AnnotationException
38  
-     */
39  
-    public static function syntaxError($message)
40  
-    {
41  
-        return new self('[Syntax Error] ' . $message);
42  
-    }
43  
-
44  
-    /**
45  
-     * Creates a new AnnotationException describing a Semantical error.
46  
-     *
47  
-     * @param string $message Exception message
48  
-     * @return AnnotationException
49  
-     */
50  
-    public static function semanticalError($message)
51  
-    {
52  
-        return new self('[Semantical Error] ' . $message);
53  
-    }
54  
-
55  
-    /**
56  
-     * Creates a new AnnotationException describing a constant semantical error.
57  
-     *
58  
-     * @since 2.3
59  
-     * @param string $identifier
60  
-     * @param string $context
61  
-     * @return AnnotationException
62  
-     */
63  
-    public static function semanticalErrorConstants($identifier, $context = null)
64  
-    {
65  
-        return self::semanticalError(sprintf(
66  
-            "Couldn't find constant %s%s", $identifier,
67  
-            $context ? ", $context." : "."
68  
-        ));
69  
-    }
70  
-
71  
-    /**
72  
-     * Creates a new AnnotationException describing an error which occurred during
73  
-     * the creation of the annotation.
74  
-     *
75  
-     * @since 2.2
76  
-     * @param string $message
77  
-     * @return AnnotationException
78  
-     */
79  
-    public static function creationError($message)
80  
-    {
81  
-        return new self('[Creation Error] ' . $message);
82  
-    }
83  
-
84  
-    /**
85  
-     * Creates a new AnnotationException describing an type error of an attribute.
86  
-     *
87  
-     * @since 2.2
88  
-     * @param string $attributeName
89  
-     * @param string $annotationName
90  
-     * @param string $context
91  
-     * @param string $expected
92  
-     * @param mixed $actual
93  
-     * @return AnnotationException
94  
-     */
95  
-    public static function typeError($attributeName, $annotationName, $context, $expected, $actual)
96  
-    {
97  
-        return new self(sprintf(
98  
-            '[Type Error] Attribute "%s" of @%s declared on %s expects %s, but got %s.',
99  
-            $attributeName,
100  
-            $annotationName,
101  
-            $context,
102  
-            $expected,
103  
-            is_object($actual) ? 'an instance of '.get_class($actual) : gettype($actual)
104  
-        ));
105  
-    }
106  
-
107  
-    /**
108  
-     * Creates a new AnnotationException describing an required error of an attribute.
109  
-     *
110  
-     * @since 2.2
111  
-     * @param string $attributeName
112  
-     * @param string $annotationName
113  
-     * @param string $context
114  
-     * @param string $expected
115  
-     * @return AnnotationException
116  
-     */
117  
-    public static function requiredError($attributeName, $annotationName, $context, $expected)
118  
-    {
119  
-        return new self(sprintf(
120  
-            '[Type Error] Attribute "%s" of @%s declared on %s expects %s. This value should not be null.',
121  
-            $attributeName,
122  
-            $annotationName,
123  
-            $context,
124  
-            $expected
125  
-        ));
126  
-    }
127  
-
128  
-    /**
129  
-     * Creates a new AnnotationException describing a invalid enummerator.
130  
-     *
131  
-     * @since 2.4
132  
-     * @param string $attributeName
133  
-     * @param string $annotationName
134  
-     * @param string $context
135  
-     * @param array  $available
136  
-     * @param mixed  $given
137  
-     * @return AnnotationException
138  
-     */
139  
-    public static function enumeratorError($attributeName, $annotationName, $context, $available, $given)
140  
-    {
141  
-        throw new self(sprintf(
142  
-            '[Enum Error] Attribute "%s" of @%s declared on %s accept only [%s], but got %s.',
143  
-            $attributeName, 
144  
-            $annotationName,
145  
-            $context,
146  
-            implode(', ', $available),
147  
-            is_object($given) ? get_class($given) : $given
148  
-        ));
149  
-    }
150  
-}
310  lib/Doctrine/Common/Annotations/AnnotationReader.php
... ...
@@ -1,310 +0,0 @@
1  
-<?php
2  
-/*
3  
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4  
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5  
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6  
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7  
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8  
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9  
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10  
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11  
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12  
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13  
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14  
- *
15  
- * This software consists of voluntary contributions made by many individuals
16  
- * and is licensed under the MIT license. For more information, see
17  
- * <http://www.doctrine-project.org>.
18  
- */
19  
-
20  
-namespace Doctrine\Common\Annotations;
21  
-
22  
-use Doctrine\Common\Annotations\Annotation\IgnoreAnnotation;
23  
-use Doctrine\Common\Annotations\Annotation\Target;
24  
-use Closure;
25  
-use ReflectionClass;
26  
-use ReflectionMethod;
27  
-use ReflectionProperty;
28  
-
29  
-/**
30  
- * A reader for docblock annotations.
31  
- *
32  
- * @author  Benjamin Eberlei <kontakt@beberlei.de>
33  
- * @author  Guilherme Blanco <guilhermeblanco@hotmail.com>
34  
- * @author  Jonathan Wage <jonwage@gmail.com>
35  
- * @author  Roman Borschel <roman@code-factory.org>
36  
- * @author  Johannes M. Schmitt <schmittjoh@gmail.com>
37  
- */
38  
-class AnnotationReader implements Reader
39  
-{
40  
-    /**
41  
-     * Global map for imports.
42  
-     *
43  
-     * @var array
44  
-     */
45  
-    private static $globalImports = array(
46  
-        'ignoreannotation' => 'Doctrine\Common\Annotations\Annotation\IgnoreAnnotation',
47  
-    );
48  
-
49  
-    /**
50  
-     * A list with annotations that are not causing exceptions when not resolved to an annotation class.
51  
-     *
52  
-     * The names are case sensitive.
53  
-     *
54  
-     * @var array
55  
-     */
56  
-    private static $globalIgnoredNames = array(
57  
-        'access'=> true, 'author'=> true, 'copyright'=> true, 'deprecated'=> true,
58  
-        'example'=> true, 'ignore'=> true, 'internal'=> true, 'link'=> true, 'see'=> true,
59  
-        'since'=> true, 'tutorial'=> true, 'version'=> true, 'package'=> true,
60  
-        'subpackage'=> true, 'name'=> true, 'global'=> true, 'param'=> true,
61  
-        'return'=> true, 'staticvar'=> true, 'category'=> true, 'staticVar'=> true,
62  
-        'static'=> true, 'var'=> true, 'throws'=> true, 'inheritdoc'=> true,
63  
-        'inheritDoc'=> true, 'license'=> true, 'todo'=> true, 'TODO'=> true,
64  
-        'deprec'=> true, 'property' => true, 'method' => true,
65  
-        'abstract'=> true, 'exception'=> true, 'magic' => true, 'api' => true,
66  
-        'final'=> true, 'filesource'=> true, 'throw' => true, 'uses' => true,
67  
-        'usedby'=> true, 'private' => true, 'Annotation' => true, 'override' => true,
68  
-        'codeCoverageIgnore' => true, 'codeCoverageIgnoreStart' => true, 'codeCoverageIgnoreEnd' => true,
69  
-        'Required' => true, 'Attribute' => true, 'Attributes' => true,
70  
-        'Target' => true, 'SuppressWarnings' => true,
71  
-        'ingroup' => true, 'code' => true, 'endcode' => true,
72  
-        'package_version' => true, 'fixme' => true
73  
-    );
74  
-
75  
-    /**
76  
-     * Add a new annotation to the globally ignored annotation names with regard to exception handling.
77  
-     *
78  
-     * @param string $name
79  
-     */
80  
-    static public function addGlobalIgnoredName($name)
81  
-    {
82  
-        self::$globalIgnoredNames[$name] = true;
83  
-    }
84  
-
85  
-    /**
86  
-     * Annotations Parser
87  
-     *
88  
-     * @var \Doctrine\Common\Annotations\DocParser
89  
-     */
90  
-    private $parser;
91  
-
92  
-    /**
93  
-     * Annotations Parser used to collect parsing metadata
94  
-     *
95  
-     * @var \Doctrine\Common\Annotations\DocParser
96  
-     */
97  
-    private $preParser;
98  
-
99  
-    /**
100  
-     * PHP Parser used to collect imports.
101  
-     *
102  
-     * @var \Doctrine\Common\Annotations\PhpParser
103  
-     */
104  
-    private $phpParser;
105  
-
106  
-    /**
107  
-     * In-memory cache mechanism to store imported annotations per class.
108  
-     *
109  
-     * @var array
110  
-     */
111  
-    private $imports = array();
112  
-
113  
-    /**
114  
-     * In-memory cache mechanism to store ignored annotations per class.
115  
-     *
116  
-     * @var array
117  
-     */
118  
-    private $ignoredAnnotationNames = array();
119  
-
120  
-    /**
121  
-     * Constructor.
122  
-     *
123  
-     * Initializes a new AnnotationReader.
124  
-     */
125  
-    public function __construct()
126  
-    {
127  
-        AnnotationRegistry::registerFile(__DIR__ . '/Annotation/IgnoreAnnotation.php');
128  
-
129  
-        $this->parser = new DocParser;
130  
-
131  
-        $this->preParser = new DocParser;
132  
-        $this->preParser->setImports(self::$globalImports);
133  
-        $this->preParser->setIgnoreNotImportedAnnotations(true);
134  
-
135  
-        $this->phpParser = new PhpParser;
136  
-    }
137  
-
138  
-    /**
139  
-     * Gets the annotations applied to a class.
140  
-     *
141  
-     * @param ReflectionClass $class The ReflectionClass of the class from which
142  
-     *                               the class annotations should be read.
143  
-     * @return array An array of Annotations.
144  
-     */
145  
-    public function getClassAnnotations(ReflectionClass $class)
146  
-    {
147  
-        $this->parser->setTarget(Target::TARGET_CLASS);
148  
-        $this->parser->setImports($this->getImports($class));
149  
-        $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class));
150  
-
151  
-        return $this->parser->parse($class->getDocComment(), 'class ' . $class->getName());
152  
-    }
153  
-
154  
-    /**
155  
-     * Gets a class annotation.
156  
-     *
157  
-     * @param ReflectionClass $class The ReflectionClass of the class from which
158  
-     *                               the class annotations should be read.
159  
-     * @param string $annotationName The name of the annotation.
160  
-     * @return mixed The Annotation or NULL, if the requested annotation does not exist.
161  
-     */
162  
-    public function getClassAnnotation(ReflectionClass $class, $annotationName)
163  
-    {
164  
-        $annotations = $this->getClassAnnotations($class);
165  
-
166  
-        foreach ($annotations as $annotation) {
167  
-            if ($annotation instanceof $annotationName) {
168  
-                return $annotation;
169  
-            }
170  
-        }
171  
-
172  
-        return null;
173  
-    }
174  
-
175  
-    /**
176  
-     * Gets the annotations applied to a property.
177  
-     *
178  
-     * @param ReflectionProperty $property The ReflectionProperty of the property
179  
-     *                                     from which the annotations should be read.
180  
-     * @return array An array of Annotations.
181  
-     */
182  
-    public function getPropertyAnnotations(ReflectionProperty $property)
183  
-    {
184  
-        $class = $property->getDeclaringClass();
185  
-        $context = 'property ' . $class->getName() . "::\$" . $property->getName();
186  
-        $this->parser->setTarget(Target::TARGET_PROPERTY);
187  
-        $this->parser->setImports($this->getImports($class));
188  
-        $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class));
189  
-
190  
-        return $this->parser->parse($property->getDocComment(), $context);
191  
-    }
192  
-
193  
-    /**
194  
-     * Gets a property annotation.
195  
-     *
196  
-     * @param ReflectionProperty $property
197  
-     * @param string $annotationName The name of the annotation.
198  
-     * @return mixed The Annotation or NULL, if the requested annotation does not exist.
199  
-     */
200  
-    public function getPropertyAnnotation(ReflectionProperty $property, $annotationName)
201  
-    {
202  
-        $annotations = $this->getPropertyAnnotations($property);
203  
-
204  
-        foreach ($annotations as $annotation) {
205  
-            if ($annotation instanceof $annotationName) {
206  
-                return $annotation;
207  
-            }
208  
-        }
209  
-
210  
-        return null;
211  
-    }
212  
-
213  
-    /**
214  
-     * Gets the annotations applied to a method.
215  
-     *
216  
-     * @param \ReflectionMethod $method The ReflectionMethod of the method from which
217  
-     *                                   the annotations should be read.
218  
-     *
219  
-     * @return array An array of Annotations.
220  
-     */
221  
-    public function getMethodAnnotations(ReflectionMethod $method)
222  
-    {
223  
-        $class = $method->getDeclaringClass();
224  
-        $context = 'method ' . $class->getName() . '::' . $method->getName() . '()';
225  
-        $this->parser->setTarget(Target::TARGET_METHOD);
226  
-        $this->parser->setImports($this->getImports($class));
227  
-        $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class));
228  
-
229  
-        return $this->parser->parse($method->getDocComment(), $context);
230  
-    }
231  
-
232  
-    /**
233  
-     * Gets a method annotation.
234  
-     *
235  
-     * @param ReflectionMethod $method
236  
-     * @param string $annotationName The name of the annotation.
237  
-     * @return mixed The Annotation or NULL, if the requested annotation does not exist.
238  
-     */
239  
-    public function getMethodAnnotation(ReflectionMethod $method, $annotationName)
240  
-    {
241  
-        $annotations = $this->getMethodAnnotations($method);
242  
-
243  
-        foreach ($annotations as $annotation) {
244  
-            if ($annotation instanceof $annotationName) {
245  
-                return $annotation;
246  
-            }
247  
-        }
248  
-
249  
-        return null;
250  
-    }
251  
-
252  
-    /**
253  
-     * Returns the ignored annotations for the given class.
254  
-     *
255  
-     * @param ReflectionClass $class
256  
-     * @return array
257  
-     */
258  
-    private function getIgnoredAnnotationNames(ReflectionClass $class)
259  
-    {
260  
-        if (isset($this->ignoredAnnotationNames[$name = $class->getName()])) {
261  
-            return $this->ignoredAnnotationNames[$name];
262  
-        }
263  
-        $this->collectParsingMetadata($class);
264  
-
265  
-        return $this->ignoredAnnotationNames[$name];
266  
-    }
267  
-
268  
-    /**
269  
-     * Retrieve imports
270  
-     *
271  
-     * @param \ReflectionClass $class
272  
-     * @return array
273  
-     */
274  
-    private function getImports(ReflectionClass $class)
275  
-    {
276  
-        if (isset($this->imports[$name = $class->getName()])) {
277  
-            return $this->imports[$name];
278  
-        }
279  
-        $this->collectParsingMetadata($class);
280  
-
281  
-        return $this->imports[$name];
282  
-    }
283  
-
284  
-    /**
285  
-     * Collects parsing metadata for a given class
286  
-     *
287  
-     * @param ReflectionClass $class
288  
-     */
289  
-    private function collectParsingMetadata(ReflectionClass $class)
290  
-    {
291  
-        $ignoredAnnotationNames = self::$globalIgnoredNames;
292  
-
293  
-        $annotations = $this->preParser->parse($class->getDocComment(), 'class '.$class->name);
294  
-        foreach ($annotations as $annotation) {
295  
-            if ($annotation instanceof IgnoreAnnotation) {
296  
-                foreach ($annotation->names AS $annot) {
297  
-                    $ignoredAnnotationNames[$annot] = true;
298  
-                }
299  
-            }
300  
-        }
301  
-
302  
-        $name = $class->getName();
303  
-        $this->imports[$name] = array_merge(
304  
-            self::$globalImports,
305  
-            $this->phpParser->parseClass($class),
306  
-            array('__NAMESPACE__' => $class->getNamespaceName())
307  
-        );
308  
-        $this->ignoredAnnotationNames[$name] = $ignoredAnnotationNames;
309  
-    }
310  
-}
139  lib/Doctrine/Common/Annotations/AnnotationRegistry.php
... ...
@@ -1,139 +0,0 @@
1  
-<?php
2  
-/*
3  
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4  
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5  
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6  
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7  
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8  
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9  
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10  
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11  
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12  
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13  
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14  
- *
15  
- * This software consists of voluntary contributions made by many individuals
16  
- * and is licensed under the MIT license. For more information, see
17  
- * <http://www.doctrine-project.org>.
18  
- */
19  
-
20  
-namespace Doctrine\Common\Annotations;
21  
-
22  
-/**
23  
- * AnnotationRegistry
24  
- */
25  
-final class AnnotationRegistry
26  
-{
27  
-    /**
28  
-     * A map of namespaces to use for autoloading purposes based on a PSR-0 convention.
29  
-     *
30  
-     * Contains the namespace as key and an array of directories as value. If the value is NULL
31  
-     * the include path is used for checking for the corresponding file.