Completed
Push — master ( 331a58...d50446 )
by Marco
293:07 queued 268:05
created

Assert::readAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProxyManagerTest;
6
7
use ReflectionObject;
8
9
/**
10
 * @internal
11
 */
12
final class Assert
13
{
14
    /**
15
     * @return mixed
16
     */
17
    public static function readAttribute(object $object, string $propertyName)
18
    {
19
        $reflection = new ReflectionObject($object);
20
        $property   = $reflection->getProperty($propertyName);
21
        $property->setAccessible(true);
22
23
        return $property->getValue($object);
24
    }
25
}
26