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

ReflectionPropertyCapabilities::setProperty()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 3
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
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