Total Complexity | 10 |
Total Lines | 58 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | final class StrictMatchingSegment implements Segment |
||
13 | { |
||
14 | public const NAME = 'strict_matching_segment'; |
||
15 | private string $id; |
||
16 | /** @var SegmentPayload */ |
||
|
|||
17 | private array $criteria; |
||
18 | |||
19 | /** @param SegmentPayload $criteria */ |
||
20 | 15 | public function __construct(string $id, array $criteria) |
|
21 | { |
||
22 | 15 | $this->id = $id; |
|
23 | 15 | $this->criteria = $criteria; |
|
24 | } |
||
25 | |||
26 | 7 | public function id(): string |
|
29 | } |
||
30 | |||
31 | 7 | public function type(): string |
|
32 | { |
||
33 | 7 | return self::NAME; |
|
34 | } |
||
35 | |||
36 | 7 | public function criteria(): array |
|
37 | { |
||
38 | 7 | return $this->criteria; |
|
39 | } |
||
40 | |||
41 | 12 | public function match(array $payload): bool |
|
42 | { |
||
43 | 12 | $match = false; |
|
44 | |||
45 | /** @var mixed $value */ |
||
46 | 12 | foreach ($this->criteria as $key => $value) { |
|
47 | 10 | if (array_key_exists($key, $payload) && $value === $payload[$key]) { |
|
48 | 6 | $match = true; |
|
49 | 6 | continue; |
|
50 | } |
||
51 | |||
52 | 4 | return false; |
|
53 | } |
||
54 | |||
55 | 8 | return $match; |
|
56 | } |
||
57 | |||
58 | 8 | public function toArray(): array |
|
59 | { |
||
60 | return [ |
||
61 | 8 | 'id' => $this->id, |
|
62 | 'type' => self::NAME, |
||
63 | 8 | 'criteria' => $this->criteria, |
|
64 | ]; |
||
65 | } |
||
66 | |||
67 | 7 | public function jsonSerialize(): array |
|
70 | } |
||
71 | } |
||
72 |
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