Passed
Push — v0.2 ( 4d3792...642965 )
by Freddie
02:51
created

ReflectionPropertyCapabilities   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 10
c 0
b 0
f 0
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
    private function setProperty($object, string $propertyName, $propertyValue): void
8
    {
9
        $refObject = new \ReflectionObject($object);
10
11
        $refProperty = $refObject->getProperty($propertyName);
12
        $refProperty->setAccessible(true);
13
        $refProperty->setValue($object, $propertyValue);
14
    }
15
}
16