1 | <?php |
||
29 | class Builder |
||
30 | { |
||
31 | /** @var Reader */ |
||
32 | private $reader; |
||
33 | /** @var PropertyFilter */ |
||
34 | private $propertyFilter; |
||
35 | /** @var PropertyMapper */ |
||
36 | private $propertyMapper; |
||
37 | |||
38 | /** @var TypeRegistry */ |
||
39 | private $typeRegistry; |
||
40 | /** @var array|Type[] Built in type, key being the type name, value a blueprint instance */ |
||
41 | private $builtInTypes; |
||
42 | |||
43 | /** |
||
44 | * @return Builder |
||
45 | */ |
||
46 | 43 | public static function createDefault() |
|
54 | |||
55 | /** |
||
56 | * C'tor |
||
57 | * |
||
58 | * @param Reader $reader |
||
59 | * @param PropertyFilter $propertyFilter |
||
60 | * @param PropertyMapper $propertyMapper |
||
61 | */ |
||
62 | 44 | public function __construct(Reader $reader, PropertyFilter $propertyFilter, PropertyMapper $propertyMapper) |
|
89 | |||
90 | /** |
||
91 | * @return PropertyFilter |
||
92 | */ |
||
93 | 1 | public function getPropertyFilter() |
|
97 | |||
98 | /** |
||
99 | * @return PropertyMapper |
||
100 | */ |
||
101 | 1 | public function getPropertyMapper() |
|
105 | |||
106 | /** |
||
107 | * @return TypeRegistry |
||
108 | */ |
||
109 | 1 | public function getTypeRegistry() |
|
113 | |||
114 | /** |
||
115 | * @return Type[] |
||
116 | */ |
||
117 | 1 | public function getBuiltInTypes() |
|
121 | |||
122 | /** |
||
123 | * Build the full name for a type. |
||
124 | * |
||
125 | * For simple types this will return "String", "Int", etc. |
||
126 | * |
||
127 | * For generic type this will return e.g. Map<String,List<Int>> |
||
128 | * |
||
129 | * @param TypeRef $ref |
||
130 | * |
||
131 | * @return string |
||
132 | */ |
||
133 | 62 | public function buildFullName(TypeRef $ref) |
|
149 | |||
150 | /** |
||
151 | * Build a type from a given TypeRef. |
||
152 | * |
||
153 | * This method is omnipotent, meaning that when ever we request a type that is already |
||
154 | * known, we will return the same instance of the Type. |
||
155 | * |
||
156 | * A type is considered to be known when the fullName |
||
157 | * a) matches a built in type like "String", "DateTime", "Int" |
||
158 | * b) is already present in the type registry |
||
159 | * |
||
160 | * @param TypeRef $ref |
||
161 | * |
||
162 | * @return Type |
||
163 | */ |
||
164 | 34 | public function buildForRef(TypeRef $ref) |
|
197 | |||
198 | /** |
||
199 | * Build the type from a given reflection class. |
||
200 | * |
||
201 | * @param \ReflectionClass $class |
||
202 | * |
||
203 | * @return Type |
||
204 | */ |
||
205 | 15 | public function buildForClass(\ReflectionClass $class) |
|
240 | |||
241 | /** |
||
242 | * @param ObjectType $type |
||
243 | * |
||
244 | * @return Property[] |
||
245 | */ |
||
246 | 1 | public function getAllProperties(ObjectType $type) |
|
262 | |||
263 | /** |
||
264 | * @param ObjectType $type |
||
265 | * @param \ReflectionClass $class |
||
266 | */ |
||
267 | 11 | private function populateObjectType(ObjectType $type, \ReflectionClass $class) |
|
304 | |||
305 | /** |
||
306 | * @param \ReflectionProperty $property |
||
307 | * |
||
308 | * @return Property |
||
309 | */ |
||
310 | 10 | private function buildProperty(\ReflectionProperty $property) |
|
321 | |||
322 | /** |
||
323 | * TODO: should we extract extended reflection functionality into the Mirror ? |
||
324 | * |
||
325 | * @param \ReflectionProperty $prop |
||
326 | * |
||
327 | * @return \ReflectionClass |
||
328 | */ |
||
329 | 10 | public static function getRealDeclaringClass(\ReflectionProperty $prop) |
|
333 | |||
334 | /** |
||
335 | * Get the exact class or trait that defines a property. |
||
336 | * |
||
337 | * TODO: should we extract extended reflection functionality into the Mirror ? |
||
338 | * |
||
339 | * @param \ReflectionClass $class |
||
340 | * @param \ReflectionProperty $prop |
||
341 | * |
||
342 | * @return \ReflectionClass |
||
343 | */ |
||
344 | 10 | private static function getRealDeclaringClassInternal(\ReflectionClass $class, \ReflectionProperty $prop) |
|
357 | |||
358 | /** |
||
359 | * Get the class declaring the property after traits are resolved. |
||
360 | * |
||
361 | * TODO: should we extract extended reflection functionality into the Mirror ? |
||
362 | * |
||
363 | * @param \ReflectionClass $class |
||
364 | * @param \ReflectionProperty $prop |
||
365 | * |
||
366 | * @return \ReflectionClass |
||
367 | */ |
||
368 | 10 | public static function getDeclaringClassInInheritanceChain(\ReflectionClass $class, \ReflectionProperty $prop) |
|
378 | } |
||
379 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.