Conditions | 4 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
53 | 10 | private static function getSchema($parameter, $key) |
|
54 | { |
||
55 | 10 | if (is_object($parameter)) { |
|
56 | // list validation |
||
57 | 8 | return $parameter; |
|
58 | 6 | } elseif (is_array($parameter) && array_key_exists($key, $parameter)) { |
|
59 | // tuple validation |
||
60 | 6 | return $parameter[$key]; |
|
61 | } |
||
62 | |||
63 | 2 | return null; |
|
64 | } |
||
65 | } |
||
66 |
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.