1 | <?php |
||
10 | class TypeMap |
||
11 | { |
||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | private $destinationType; |
||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | private $sourceType; |
||
20 | /** |
||
21 | * @var ObjectCreatorInterface |
||
22 | */ |
||
23 | private $objectCreator; |
||
24 | /** |
||
25 | * @var PropertyMap[] |
||
26 | */ |
||
27 | private $propertyMaps = array(); |
||
28 | /** |
||
29 | * @var \Closure|null |
||
30 | */ |
||
31 | private $beforeMapFunc; |
||
32 | /** |
||
33 | * @var \Closure|null |
||
34 | */ |
||
35 | private $afterMapFunc; |
||
36 | |||
37 | public function __construct($sourceType, $destinationType, ObjectCreatorInterface $objectCreator) |
||
43 | |||
44 | /** |
||
45 | * @return string |
||
46 | */ |
||
47 | public function getDestinationType() |
||
51 | |||
52 | /** |
||
53 | * @return string |
||
54 | */ |
||
55 | public function getSourceType() |
||
59 | |||
60 | /** |
||
61 | * @return ObjectCreatorInterface |
||
62 | */ |
||
63 | public function getObjectCreator() |
||
67 | |||
68 | /** |
||
69 | * @param ObjectCreatorInterface $objectCreator |
||
70 | */ |
||
71 | public function setObjectCreator(ObjectCreatorInterface $objectCreator) |
||
75 | |||
76 | /** |
||
77 | * @return PropertyMap[] |
||
78 | */ |
||
79 | public function getPropertyMaps() |
||
83 | |||
84 | /** |
||
85 | * @return PropertyMap[] |
||
86 | */ |
||
87 | public function getMappedPropertyMaps() |
||
93 | |||
94 | /** |
||
95 | * @return PropertyMap[] |
||
96 | */ |
||
97 | public function getUnmappedPropertyMaps() |
||
103 | |||
104 | /** |
||
105 | * @param PropertyMap $propertyMap |
||
106 | */ |
||
107 | public function addPropertyMap(PropertyMap $propertyMap) |
||
111 | |||
112 | /** |
||
113 | * @param string $memberName |
||
114 | * @return null|PropertyMap |
||
115 | */ |
||
116 | public function getPropertyMap($memberName) |
||
122 | |||
123 | /** |
||
124 | * @return callable|null |
||
|
|||
125 | */ |
||
126 | public function getBeforeMapFunc() |
||
130 | |||
131 | /** |
||
132 | * @param callable $func |
||
133 | */ |
||
134 | public function setBeforeMapFunc(\Closure $func) |
||
138 | |||
139 | /** |
||
140 | * @return callable|null |
||
141 | */ |
||
142 | public function getAfterMapFunc() |
||
146 | |||
147 | /** |
||
148 | * @param callable $func |
||
149 | */ |
||
150 | public function setAfterMapFunc(\Closure $func) |
||
154 | |||
155 | /** |
||
156 | * @todo validate source members |
||
157 | * @todo validate constructor args |
||
158 | */ |
||
159 | public function validate() |
||
177 | |||
178 | public function getMapFunc() |
||
227 | } |
||
228 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.