friendica/vendor/pear/text_languagedetect/tests/PrivProxy.php
Hypolite Petovan 7d876aab98 Add pear/Text_LanguageDetect to Composer/vendor
- Updated mobiledetectlib to 2.8.26
- Updated PEAR to 1.10.5
- Updated Archive_Tar to 1.4.3
- Updated XML_Util to 1.4.3
2017-11-05 08:34:02 -05:00

43 lines
1,004 B
PHP

<?php
/**
* Helper that enables access to private and protected methods and properties.
*/
class PrivProxy
{
private $obj;
public function __construct($obj)
{
$this->obj = $obj;
}
public function __call($method, $arguments)
{
$rm = new ReflectionMethod($this->obj, $method);
$rm->setAccessible(true);
return $rm->invokeArgs($this->obj, $arguments);
}
public static function __callStatic($method, $arguments)
{
$rm = new ReflectionMethod($this->obj, $method);
$rm->setAccessible(true);
return $rm->invokeArgs($this->obj, $arguments);
}
public function __set($var, $value)
{
$rp = new ReflectionProperty($this->obj, $var);
$rp->setAccessible(true);
$rp->setValue($this->obj, $value);
}
public function __get($var)
{
$rp = new ReflectionProperty($this->obj, $var);
$rp->setAccessible(true);
return $rp->getValue($this->obj);
}
}
?>