SUExecutor   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A setups() 0 15 5
1
<?php
2
/**
3
 * Setup executor
4
 * User: moyo
5
 * Date: 2018/5/29
6
 * Time: 2:14 PM
7
 */
8
9
namespace Carno\Web\Chips\Router;
10
11
use Carno\Web\Router\Setup;
12
use ReflectionClass;
13
use ReflectionMethod;
14
15
trait SUExecutor
16
{
17
    /**
18
     * @return array
19
     */
20
    protected function setups() : array
21
    {
22
        $methods = [];
23
24
        foreach ((new ReflectionClass($this))->getMethods(ReflectionMethod::IS_PROTECTED) as $method) {
25
            foreach ($method->getParameters() as $parameter) {
26
                if ($required = $parameter->getClass()) {
27
                    if ($required->getName() === Setup::class) {
28
                        $methods[] = $method->getName();
29
                    }
30
                }
31
            }
32
        }
33
34
        return $methods;
35
    }
36
}
37