| Total Complexity | 11 |
| Total Lines | 68 |
| Duplicated Lines | 0 % |
| Coverage | 41.67% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | abstract class Utility |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Returns the short class name of any object, eg: Application\Model\Calendar => Calendar |
||
| 13 | * |
||
| 14 | * @param object|string $object |
||
| 15 | * |
||
| 16 | * @return string |
||
| 17 | */ |
||
| 18 | 3 | public static function getShortClassName($object): string |
|
| 19 | { |
||
| 20 | 3 | $reflect = new \ReflectionClass($object); |
|
| 21 | |||
| 22 | 3 | return $reflect->getShortName(); |
|
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Print a list of files if non empty |
||
| 27 | * |
||
| 28 | * @param string $title |
||
| 29 | * @param array $files |
||
| 30 | */ |
||
| 31 | public static function printFiles(string $title, array $files): void |
||
| 32 | { |
||
| 33 | if (!$files) { |
||
| 34 | return; |
||
| 35 | } |
||
| 36 | |||
| 37 | echo $title . PHP_EOL . PHP_EOL; |
||
| 38 | |||
| 39 | foreach ($files as $file) { |
||
| 40 | echo ' ' . escapeshellarg($file) . PHP_EOL; |
||
| 41 | } |
||
| 42 | echo PHP_EOL; |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Replace EntityID model and don't touch other values |
||
| 47 | * |
||
| 48 | * @param array $data mix of objects and scalar values |
||
| 49 | * |
||
| 50 | * @return null|array |
||
| 51 | */ |
||
| 52 | 1 | public static function entityIdToModel(?array $data): ?array |
|
| 65 | } |
||
| 66 | |||
| 67 | public static function unique(array $array): array |
||
| 79 |