ReflectionPropertyCapabilities   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
c 0
b 0
f 0
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A setProperty() 0 7 1
1
<?php declare(strict_types = 1);
2
3
namespace Simplex\Quickstart\Shared\Testing;
4
5
trait ReflectionPropertyCapabilities
6
{
7
    /**
8
     * @param mixed $object
9
     * @param mixed $propertyValue
10
     */
11
    private function setProperty($object, string $propertyName, $propertyValue): void
12
    {
13
        $refObject = new \ReflectionObject($object);
14
15
        $refProperty = $refObject->getProperty($propertyName);
16
        $refProperty->setAccessible(true);
17
        $refProperty->setValue($object, $propertyValue);
18
    }
19
}
20