Conditions | 2 |
Paths | 1 |
Total Lines | 22 |
Code Lines | 13 |
Lines | 22 |
Ratio | 100 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
61 | public function dump(array $exclude = []) |
||
62 | { |
||
63 | $array = array_diff_key( |
||
64 | array_filter( |
||
65 | get_object_vars($this), |
||
66 | function ($value) { |
||
67 | return $value || is_bool($value); |
||
68 | } |
||
69 | ), |
||
70 | array_flip(array_merge(['name', 'objectName', 'multiple'], $exclude)) |
||
71 | ); |
||
72 | |||
73 | return array_combine( |
||
74 | array_map( |
||
75 | function ($key) { |
||
76 | return Caser::snake($key); |
||
77 | }, |
||
78 | array_keys($array) |
||
79 | ), |
||
80 | array_values($array) |
||
81 | ); |
||
82 | } |
||
83 | } |
||
84 |
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.