Conditions | 6 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | public function traitor($method_name) |
||
8 | { |
||
9 | $ret = []; |
||
10 | |||
11 | $regex = sprintf($this->traitorPattern(), $method_name); |
||
12 | |||
13 | $traits = (new \ReflectionClass($this))->getTraitNames(); |
||
14 | foreach ($traits as $trait_name) { |
||
15 | $trait_methods = (new \ReflectionClass($trait_name))->getMethods(); |
||
16 | foreach ($trait_methods as $method) { |
||
17 | if (preg_match($regex, $method->name, $match) === 1) { |
||
18 | $callable = current($match); |
||
19 | $res = $this->$callable(); |
||
20 | if(is_array($res) && !empty($res)) |
||
21 | $ret[$trait_name . '::' . $method->name] = $res; |
||
22 | } |
||
23 | } |
||
24 | } |
||
25 | |||
26 | return $ret; |
||
27 | } |
||
34 |