Conditions | 4 |
Paths | 4 |
Total Lines | 12 |
Lines | 12 |
Ratio | 100 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
51 | View Code Duplication | protected static function validateRelation(array $resource): void |
|
|
|||
52 | { |
||
53 | foreach ($resource as $object) { |
||
54 | if (['namespace', 'collection', 'object'] != array_keys($object)) { |
||
55 | throw new InvalidArgumentException('relation in data.relation must contain namespace, collection and object as strings'); |
||
56 | } |
||
57 | |||
58 | if (array_filter($object, 'is_string') != $object) { |
||
59 | throw new InvalidArgumentException('relation in data.relation must contain namespace, collection and object as strings'); |
||
60 | } |
||
61 | } |
||
62 | } |
||
63 | } |
||
64 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.