Code Duplication    Length = 11-11 lines in 2 locations

src/class_functions.php 2 locations

@@ 12-22 (lines=11) @@
9
 * @param string $property
10
 * @return mixed
11
 */
12
function get_private_property($object, $property)
13
{
14
    $reflObj = is_object($object) ?
15
        new \ReflectionObject($object) :
16
        new \ReflectionClass($object);
17
18
    $reflProp = $reflObj->getProperty($property);
19
    $reflProp->setAccessible(true);
20
21
    return $reflProp->getValue(is_object($object) ? $object : null);
22
}
23
24
/**
25
 * Call a private or protected method
@@ 46-56 (lines=11) @@
43
 * @param array  $args
44
 * @return mixed
45
 */
46
function call_private_method_array($object, $method, array $args)
47
{
48
    $reflObj = is_object($object) ?
49
        new \ReflectionObject($object) :
50
        new \ReflectionClass($object);
51
52
    $reflMethod = $reflObj->getMethod($method);
53
    $reflMethod->setAccessible(true);
54
55
    return $reflMethod->invokeArgs(is_object($object) ? $object : null, $args);
56
}
57