1 | <?php |
||
13 | class Parser extends DynamicParser |
||
14 | { |
||
15 | /** |
||
16 | * The lexer table of parsable types in a given docblock |
||
17 | * declared in a ['token' => 'symbol'] associative array |
||
18 | * |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $types = [ |
||
22 | '\Minime\Annotations\Types\IntegerType' => 'integer', |
||
23 | '\Minime\Annotations\Types\StringType' => 'string', |
||
24 | '\Minime\Annotations\Types\FloatType' => 'float', |
||
25 | '\Minime\Annotations\Types\JsonType' => 'json', |
||
26 | '\Minime\Annotations\Types\ConcreteType' => '->' |
||
27 | ]; |
||
28 | |||
29 | /** |
||
30 | * The regex equivalent of $types |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $typesPattern; |
||
35 | |||
36 | /** |
||
37 | * Parser constructor |
||
38 | * |
||
39 | */ |
||
40 | public function __construct() |
||
45 | |||
46 | public function registerType($class, $token) |
||
51 | |||
52 | public function unregisterType($class) |
||
57 | |||
58 | /** |
||
59 | * Parse a single annotation value |
||
60 | * |
||
61 | * @param string $value |
||
62 | * @param string $key |
||
63 | * @return mixed |
||
64 | */ |
||
65 | protected function parseValue($value, $key = null) |
||
79 | |||
80 | /** |
||
81 | * Makes `@\My\Namespaced\Class` equivalent of `@My\Namespaced\Class` |
||
82 | * |
||
83 | * @param string $key |
||
84 | * @return string |
||
85 | */ |
||
86 | protected function sanitizeKey($key) |
||
94 | |||
95 | protected function buildTypesPattern() |
||
99 | } |
||
100 |