ReflectionTrait::createAccessibleProperty()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 6
rs 10
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