Conditions | 8 |
Paths | 15 |
Total Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Tests | 17 |
CRAP Score | 8 |
Changes | 0 |
1 | <?php |
||
12 | 7 | public function run(Filesystem $fs) |
|
13 | { |
||
14 | 7 | $routes = []; |
|
15 | 7 | foreach ($fs->listClasses('Controller') as $class) { |
|
16 | 7 | $nick = substr(strtolower($class), 11); |
|
17 | 7 | $methods = (new ReflectionClass($class))->getMethods(ReflectionMethod::IS_PUBLIC); |
|
18 | 7 | foreach ($methods as $method) { |
|
19 | 7 | if ($method->isConstructor() || $method->getName() == '__debugInfo') { |
|
|
|||
20 | 7 | continue; |
|
21 | } |
||
22 | 7 | if ($method->name == '__process') { |
|
23 | 7 | $routes[] = $nick.'/*'; |
|
24 | } else { |
||
25 | 7 | $routes[] = $nick.'/'.$method->name; |
|
26 | } |
||
27 | } |
||
28 | } |
||
29 | |||
30 | 7 | $jobs = []; |
|
31 | 7 | foreach ($fs->listClasses('Job') as $class) { |
|
32 | 7 | $reflection = new ReflectionClass($class); |
|
33 | 7 | if (!$reflection->isAbstract()) { |
|
34 | 7 | $jobs[] = str_replace('\\', '.', substr(strtolower($class), 4)); |
|
35 | } |
||
36 | } |
||
37 | |||
38 | 7 | return compact('routes', 'jobs'); |
|
39 | } |
||
40 | } |
||
41 |