| Total Complexity | 7 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class Points implements PointsInterface |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var CollectionInterface |
||
| 14 | */ |
||
| 15 | private $collections; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param CollectionInterface[] $collections |
||
| 19 | */ |
||
| 20 | public function __construct(...$collections) |
||
| 21 | { |
||
| 22 | $this->collections = $collections; |
||
|
|
|||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param Result $result |
||
| 27 | * @return int |
||
| 28 | */ |
||
| 29 | public function get(Result $result): int |
||
| 30 | { |
||
| 31 | $this->checkCollection(); |
||
| 32 | |||
| 33 | usort($this->collections, function ($a, $b) { |
||
| 34 | return $a->getScore() <=> $b->getScore(); |
||
| 35 | }); |
||
| 36 | $this->collections = array_reverse($this->collections); |
||
| 37 | |||
| 38 | foreach ($this->collections as $collection) { |
||
| 39 | if ($collection->check($result) === true) { |
||
| 40 | $score = $collection->getScore(); |
||
| 41 | break; |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 | return $score; |
||
| 46 | } |
||
| 47 | |||
| 48 | |||
| 49 | private function checkCollection() |
||
| 54 | } |
||
| 55 | } |
||
| 56 | } |
||
| 59 | } |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..