@@ 40-47 (lines=8) @@ | ||
37 | return $reflectionClass->newInstanceWithoutConstructor(); |
|
38 | } |
|
39 | ||
40 | public static function setProtectedProperty($object, string $propertyName, $value) |
|
41 | { |
|
42 | $class = self::getReflectionClass(get_class($object)); |
|
43 | ||
44 | $property = ClassHelper::getReflectionProperty($class, $propertyName); |
|
45 | $property->setAccessible(true); |
|
46 | $property->setValue($object, $value); |
|
47 | } |
|
48 | ||
49 | public static function getProtectedProperty($object, string $propertyName) |
|
50 | { |
|
@@ 49-57 (lines=9) @@ | ||
46 | $property->setValue($object, $value); |
|
47 | } |
|
48 | ||
49 | public static function getProtectedProperty($object, string $propertyName) |
|
50 | { |
|
51 | $class = self::getReflectionClass(get_class($object)); |
|
52 | ||
53 | $property = ClassHelper::getReflectionProperty($class, $propertyName); |
|
54 | $property->setAccessible(true); |
|
55 | ||
56 | return $property->getValue($object); |
|
57 | } |
|
58 | } |
|
59 |