| Total Complexity | 7 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | final class Tuple implements CaseClass |
||
| 20 | { |
||
| 21 | use Deconstruction; |
||
| 22 | |||
| 23 | private $elements; |
||
| 24 | |||
| 25 | public function __construct(...$elements) |
||
| 26 | { |
||
| 27 | if (\count($elements) === 0) { |
||
| 28 | throw new \InvalidArgumentException('Tuple must by construct with at least one element.'); |
||
| 29 | } |
||
| 30 | |||
| 31 | $this->construct(...$elements); |
||
| 32 | |||
| 33 | $this->elements = $elements; |
||
| 34 | } |
||
| 35 | |||
| 36 | public function __get($name) |
||
| 37 | { |
||
| 38 | return $this |
||
| 39 | ->elementId($name) |
||
| 40 | ->map(papply(inc, __, -1)) |
||
| 41 | ->flatMap(\Closure::fromCallable([$this, 'element'])) |
||
| 42 | ->fold( |
||
| 43 | delay(throwE, NoSuchElementException::class, "Tuple->$name"), |
||
| 44 | identity |
||
| 45 | ); |
||
| 46 | } |
||
| 47 | |||
| 48 | private function elementId(string $propertyName): Option |
||
| 49 | { |
||
| 50 | preg_match('/^_(\d+)$/', $propertyName, $matches); |
||
| 51 | |||
| 52 | return isset($matches[1]) ? Some((int) $matches[1]) : None(); |
||
| 53 | } |
||
| 54 | |||
| 55 | private function element(int $id): Option |
||
| 58 | } |
||
| 59 | } |
||
| 60 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths