]> git.mxchange.org Git - friendica.git/blob - library/langdet/tests/PrivProxy.php
Merge branch 'vagrant2' of https://github.com/silke/friendica into develop
[friendica.git] / library / langdet / tests / PrivProxy.php
1 <?php
2 /**
3  * Helper that enables access to private and protected methods and properties.
4  */
5 class PrivProxy
6 {
7     private $obj;
8
9     public function __construct($obj)
10     {
11         $this->obj = $obj;
12     }
13
14     public function __call($method, $arguments)
15     {
16         $rm = new ReflectionMethod($this->obj, $method);
17         $rm->setAccessible(true);
18         return $rm->invokeArgs($this->obj, $arguments);
19     }
20
21     public static function __callStatic($method, $arguments)
22     {
23         $rm = new ReflectionMethod($this->obj, $method);
24         $rm->setAccessible(true);
25         return $rm->invokeArgs($this->obj, $arguments);
26     }
27
28     public function __set($var, $value)
29     {
30         $rp = new ReflectionProperty($this->obj, $var);
31         $rp->setAccessible(true);
32         $rp->setValue($this->obj, $value);
33     }
34
35     public function __get($var)
36     {
37         $rp = new ReflectionProperty($this->obj, $var);
38         $rp->setAccessible(true);
39         return $rp->getValue($this->obj);
40     }
41 }
42 ?>