@@ -3,38 +3,38 @@ |
||
3 | 3 | |
4 | 4 | class TestHelper{ |
5 | 5 | |
6 | - /** |
|
7 | - * получение защищенного свойства |
|
8 | - * @param type $o |
|
9 | - * @param type $name |
|
10 | - * @return type |
|
11 | - */ |
|
12 | - static public function getProtectedAttribute($obj, $name) |
|
13 | - { |
|
14 | - $reflectionClass = new \ReflectionClass($obj); //создаем reflectionClass |
|
15 | - $r = $reflectionClass->getProperty($name); //получаем свойство |
|
16 | - $r->setAccessible(true); //делаем открытым |
|
17 | - return $r->getValue($obj); |
|
18 | - } |
|
6 | + /** |
|
7 | + * получение защищенного свойства |
|
8 | + * @param type $o |
|
9 | + * @param type $name |
|
10 | + * @return type |
|
11 | + */ |
|
12 | + static public function getProtectedAttribute($obj, $name) |
|
13 | + { |
|
14 | + $reflectionClass = new \ReflectionClass($obj); //создаем reflectionClass |
|
15 | + $r = $reflectionClass->getProperty($name); //получаем свойство |
|
16 | + $r->setAccessible(true); //делаем открытым |
|
17 | + return $r->getValue($obj); |
|
18 | + } |
|
19 | 19 | |
20 | - /** |
|
21 | - * Добавление значения в защищенное свойтсво |
|
22 | - * @param type $name |
|
23 | - * @param type $valued |
|
24 | - */ |
|
25 | - static public function setValueprotectedProperty($obj, $name, $value) |
|
26 | - { |
|
27 | - $reflectionClass = new \ReflectionClass($obj); //создаем reflectionClass |
|
28 | - $r = $reflectionClass->getProperty($name); //получаем свойство |
|
29 | - $r->setAccessible(true); //делаем открытым |
|
30 | - $r->setValue($obj, $value); //изменяем значение |
|
31 | - } |
|
20 | + /** |
|
21 | + * Добавление значения в защищенное свойтсво |
|
22 | + * @param type $name |
|
23 | + * @param type $valued |
|
24 | + */ |
|
25 | + static public function setValueprotectedProperty($obj, $name, $value) |
|
26 | + { |
|
27 | + $reflectionClass = new \ReflectionClass($obj); //создаем reflectionClass |
|
28 | + $r = $reflectionClass->getProperty($name); //получаем свойство |
|
29 | + $r->setAccessible(true); //делаем открытым |
|
30 | + $r->setValue($obj, $value); //изменяем значение |
|
31 | + } |
|
32 | 32 | |
33 | 33 | static public function callMethod($obj, $name, array $args = []) { |
34 | - $class = new \ReflectionClass($obj); |
|
35 | - $method = $class->getMethod($name); |
|
36 | - $method->setAccessible(true); |
|
37 | - return $method->invokeArgs($obj, $args); |
|
38 | - } |
|
34 | + $class = new \ReflectionClass($obj); |
|
35 | + $method = $class->getMethod($name); |
|
36 | + $method->setAccessible(true); |
|
37 | + return $method->invokeArgs($obj, $args); |
|
38 | + } |
|
39 | 39 | |
40 | 40 | } |