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