ReflectionTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createAccessibleMethod() 0 6 1
A createAccessibleProperty() 0 6 1
1
<?php declare(strict_types=1);
2
3
namespace Janisbiz\LightOrm\Tests\Unit;
4
5
trait ReflectionTrait
6
{
7
    /**
8
     * @param object|string $class
9
     * @param string $method
10
     *
11
     * @return \ReflectionMethod
12
     */
13
    protected function createAccessibleMethod($class, string $method)
14
    {
15
        $reflectionMethod = new \ReflectionMethod($class, $method);
16
        $reflectionMethod->setAccessible(true);
17
18
        return $reflectionMethod;
19
    }
20
21
    /**
22
     * @param object|string $class
23
     * @param string $property
24
     *
25
     * @return \ReflectionProperty
26
     */
27
    protected function createAccessibleProperty($class, string $property)
28
    {
29
        $reflectionProperty = new \ReflectionProperty($class, $property);
30
        $reflectionProperty->setAccessible(true);
31
32
        return $reflectionProperty;
33
    }
34
}
35