Completed
Push — master ( 6e390f...5a6d30 )
by Dmitry
07:10 queued 04:24
created

Meta   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 24
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B run() 0 21 5
1
<?php
2
3
namespace Basis\Job\Module;
4
5
use Basis\Config;
6
use Basis\Filesystem;
7
use ReflectionClass;
8
use ReflectionMethod;
9
10
class Meta
11
{
12 2
    public function run(Filesystem $fs, Config $config)
0 ignored issues
show
Unused Code introduced by
The parameter $config is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
13
    {
14 2
        $routes = [];
15 2
        foreach ($fs->listClasses('Controller') as $class) {
16 2
            $nick = substr(strtolower($class), 11);
17 2
            $methods = (new ReflectionClass($class))->getMethods(ReflectionMethod::IS_PUBLIC);
18 2
            foreach ($methods as $method) {
19 2
                $routes[] = $nick.'/'.$method->getName();
0 ignored issues
show
Bug introduced by
Consider using $method->name. There is an issue with getName() and APC-enabled PHP versions.
Loading history...
20
            }
21
        }
22
23 2
        $jobs = [];
24 2
        foreach ($fs->listClasses('Job') as $class) {
25 2
            $reflection = new ReflectionClass($class);
26 2
            if (!$reflection->isAbstract()) {
27 2
                $jobs[] = str_replace('\\', '.', substr(strtolower($class), 4));
28
            }
29
        }
30
31 2
        return compact('routes', 'jobs');
32
    }
33
}
34