MethodsCollector   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 6
c 2
b 0
f 0
dl 0
loc 19
ccs 0
cts 7
cp 0
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A collectMethods() 0 11 3
1
<?php
2
3
namespace Terranet\Administrator\Traits;
4
5
use ReflectionClass;
6
use ReflectionMethod;
7
8
trait MethodsCollector
9
{
10
    /**
11
     * @param $instance
12
     * @param int $filter
13
     *
14
     * @return \ReflectionMethod[]
15
     */
16
    protected function collectMethods($instance, $filter = ReflectionMethod::IS_PUBLIC)
17
    {
18
        static $methodsCache = null;
19
20
        if (null === $methodsCache) {
21
            $methodsCache = $instance
22
                ? (new ReflectionClass($instance))->getMethods($filter)
23
                : [];
24
        }
25
26
        return $methodsCache;
27
    }
28
}
29