kherge / providence
此包已被弃用,不再维护。未建议替代包。
通过反射轻松进行测试。
1.0.1
2017-04-23 15:16 UTC
Requires
- php: >=7.1
This package is not auto-updated.
Last update: 2020-01-10 05:03:13 UTC
README
通过反射轻松进行测试。
此库将简单地围绕任何其他类实例提供一个装饰器类。装饰器类将提供对所有私有和受保护的类属性和方法访问。
要求
- PHP 7.1+
安装
composer require --dev kherge/providence
用法
use KHerGe\Providence\Eye; /** * An example class with private members. */ class Example { private $property = 'The property value.'; private function method() { echo "The method.\n"; } } // Create an instance of the class. $example = new Example(); // Create a instance of the decorator. $eye = new Eye($example); // Access members as if they were public! echo $eye->property, "\n"; $eye->method();