Conditions | 2 |
Paths | 1 |
Total Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 2.0011 |
Changes | 0 |
1 | <?php |
||
42 | 2 | public function execute() |
|
43 | { |
||
44 | 2 | $path = APP . 'Model' . DS . 'Table'; |
|
45 | 2 | $folder = new Folder($path); |
|
46 | 2 | $tables = $folder->find('.*\.php'); |
|
47 | 2 | $services = collection($tables) |
|
48 | ->map(function ($item) { |
||
49 | 2 | preg_match('/^(.*)Table\.php/', $item, $replacedMatch); |
|
50 | 2 | if (empty($replacedMatch[1])) { |
|
51 | return null; |
||
52 | } |
||
53 | |||
54 | 2 | return Inflector::underscore($replacedMatch[1]); |
|
55 | 2 | }) |
|
56 | 2 | ->filter(function ($item) { |
|
57 | 2 | return !empty($item); |
|
58 | 2 | }) |
|
59 | 2 | ->toArray(); |
|
60 | |||
61 | 2 | return $services; |
|
62 | } |
||
63 | } |
||
64 |