@@ 44-51 (lines=8) @@ | ||
41 | return $reflectionClass->newInstanceWithoutConstructor(); |
|
42 | } |
|
43 | ||
44 | public static function setProtectedProperty($object, string $propertyName, $value) |
|
45 | { |
|
46 | $class = self::getReflectionClass(get_class($object)); |
|
47 | ||
48 | $property = ClassHelper::getReflectionProperty($class, $propertyName); |
|
49 | $property->setAccessible(true); |
|
50 | $property->setValue($object, $value); |
|
51 | } |
|
52 | ||
53 | public static function getProtectedProperty($object, string $propertyName) |
|
54 | { |
|
@@ 53-61 (lines=9) @@ | ||
50 | $property->setValue($object, $value); |
|
51 | } |
|
52 | ||
53 | public static function getProtectedProperty($object, string $propertyName) |
|
54 | { |
|
55 | $class = self::getReflectionClass(get_class($object)); |
|
56 | ||
57 | $property = ClassHelper::getReflectionProperty($class, $propertyName); |
|
58 | $property->setAccessible(true); |
|
59 | ||
60 | return $property->getValue($object); |
|
61 | } |
|
62 | ||
63 | /** |
|
64 | * @param callable $input Can be a callable array (method defaults to '__construct'), callable object or Closure |