1 | <?php |
||
18 | class HigherOrderCollectionProxy |
||
19 | { |
||
20 | /** |
||
21 | * This pattern is used to specify the location of the delegate in |
||
22 | * the function arguments in the high-order messaging. |
||
23 | */ |
||
24 | public const PATTERN = '_'; |
||
25 | |||
26 | /** |
||
27 | * @var Collection |
||
28 | */ |
||
29 | private $collection; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | private $method; |
||
35 | |||
36 | /** |
||
37 | * HighOrderCollectionProxy constructor. |
||
38 | * @param Collection $collection |
||
39 | * @param string $method |
||
40 | */ |
||
41 | public function __construct(Collection $collection, string $method) |
||
46 | |||
47 | /** |
||
48 | * @param string $property |
||
49 | * @return Collection|mixed |
||
50 | */ |
||
51 | public function __get(string $property) |
||
77 | |||
78 | /** |
||
79 | * @param string $method |
||
80 | * @param array $arguments |
||
81 | * @return Collection|mixed |
||
82 | */ |
||
83 | public function __call(string $method, array $arguments = []) |
||
109 | |||
110 | /** |
||
111 | * @param object $context |
||
112 | * @return bool |
||
113 | */ |
||
114 | private function isArrayable($context): bool |
||
118 | |||
119 | /** |
||
120 | * @param object $context |
||
121 | * @param string $key |
||
122 | * @return bool |
||
123 | */ |
||
124 | private function hasCallableKey($context, string $key): bool |
||
128 | |||
129 | /** |
||
130 | * @param object $context |
||
131 | * @param string $property |
||
132 | * @return bool |
||
133 | */ |
||
134 | private function hasProperty($context, string $property): bool |
||
141 | |||
142 | /** |
||
143 | * @param object $context |
||
144 | * @param string $property |
||
145 | * @return bool |
||
146 | */ |
||
147 | private function hasCallableProperty($context, string $property): bool |
||
151 | |||
152 | /** |
||
153 | * @param object $context |
||
154 | * @param string $method |
||
155 | * @return bool |
||
156 | */ |
||
157 | private function hasMethod($context, string $method): bool |
||
164 | |||
165 | /** |
||
166 | * @param object $context |
||
167 | * @param array $parameters |
||
168 | * @return array |
||
169 | */ |
||
170 | private function pack($context, array $parameters): array |
||
180 | } |
||
181 |