1 | <?php |
||
11 | class MarathonEntityUtils |
||
12 | { |
||
13 | 35 | public static function setPropertyIfExist($source, $target, $property) |
|
22 | |||
23 | /** |
||
24 | * Sets all possible properties in the class from $data. |
||
25 | * If the type is array or object, then it is ignored if there is no conversion in $conversion_map. |
||
26 | * @param $data |
||
27 | * @param $target |
||
28 | * @param $conversionMap |
||
29 | * |
||
30 | * @return array all fields in $data that weren't stored in $target |
||
31 | */ |
||
32 | 45 | public static function setAllPossibleProperties($data, $target, $conversionMap = []) |
|
52 | |||
53 | /** |
||
54 | * This is useful if you don't want an array or object to be skipped by setAllPossibleProperties(). |
||
55 | */ |
||
56 | public static function noConv() { |
||
59 | |||
60 | public static function convArray() { |
||
63 | |||
64 | public static function convObject() { |
||
67 | |||
68 | /** |
||
69 | * This is usefull for shorter and stable diff output. |
||
70 | */ |
||
71 | 21 | public static function convSortedObject() { |
|
72 | return function($data) { |
||
73 | 12 | $a = (array) $data; // ksort is inplace, so we need a copy |
|
74 | 12 | ksort($a); |
|
75 | 12 | return (object) $a; |
|
76 | 21 | }; |
|
77 | } |
||
78 | |||
79 | public static function convClass($class) { |
||
82 | |||
83 | public static function convArrayOfClass($class) { |
||
94 | } |
||
95 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.