| Total Complexity | 5 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class HigherOrderWhenProxy |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * The collection being operated on. |
||
| 14 | * |
||
| 15 | * @var Enumerable |
||
| 16 | */ |
||
| 17 | protected Enumerable $collection; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * The condition for proxying. |
||
| 21 | * |
||
| 22 | * @var bool |
||
| 23 | */ |
||
| 24 | protected bool $condition; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Create a new proxy instance. |
||
| 28 | * |
||
| 29 | * @param Enumerable $collection |
||
| 30 | * @param bool $condition |
||
| 31 | * @return void |
||
| 32 | */ |
||
| 33 | public function __construct(Enumerable $collection, $condition) |
||
| 34 | { |
||
| 35 | $this->condition = $condition; |
||
| 36 | $this->collection = $collection; |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Proxy accessing an attribute onto the collection. |
||
| 41 | * |
||
| 42 | * @param string $key |
||
| 43 | * @return mixed |
||
| 44 | */ |
||
| 45 | public function __get($key) |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Proxy a method call onto the collection. |
||
| 54 | * |
||
| 55 | * @param string $method |
||
| 56 | * @param array $parameters |
||
| 57 | * @return mixed |
||
| 58 | */ |
||
| 59 | public function __call($method, $parameters) |
||
| 66 |