Completed
Push — master ( abebfb...7eccd9 )
by Dmitry
08:14 queued 06:47
created

Meta   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

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 Basis\Job;
8
use ReflectionClass;
9
use ReflectionMethod;
10
11
class Meta extends Job
12
{
13 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...
14
    {
15 2
        $routes = [];
16 2
        foreach ($fs->listClasses('Controller') as $class) {
17 2
            $nick = substr(strtolower($class), 11);
18 2
            $methods = (new ReflectionClass($class))->getMethods(ReflectionMethod::IS_PUBLIC);
19 2
            foreach ($methods as $method) {
20 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...
21
            }
22
        }
23
24 2
        $jobs = [];
25 2
        foreach ($fs->listClasses('Job') as $class) {
26 2
            $reflection = new ReflectionClass($class);
27 2
            if (!$reflection->isAbstract()) {
28 2
                $jobs[] = str_replace('\\', '.', substr(strtolower($class), 4));
29
            }
30
        }
31
32 2
        return compact('routes', 'jobs');
33
    }
34
}
35