| Conditions | 2 |
| Paths | 5 |
| Total Lines | 10 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | 2 | public function execute(object $object, string $property, $value): void |
|
| 23 | { |
||
| 24 | try { |
||
| 25 | 2 | $reflectionClass = new \ReflectionClass($object); |
|
| 26 | 2 | $reflectionProperty = $reflectionClass->getProperty($property); |
|
| 27 | 1 | $reflectionProperty->setAccessible(true); |
|
| 28 | 1 | $reflectionProperty->setValue($object, $value); |
|
| 29 | 1 | } catch (\Exception $e) { |
|
| 30 | 1 | throw new ClassPropertyNotSetException( |
|
| 31 | 1 | sprintf('Failed to set `%s` class `%s` property value.', \get_class($object), $property) |
|
| 32 | ); |
||
| 36 |