fdt2k / baseobject
PHP的ROOT风格对象
dev-master
2017-11-01 17:59 UTC
This package is auto-updated.
Last update: 2024-09-11 19:33:22 UTC
README
ROOT object for php providing the following features
1. Create function constructor.
Allow to instanciate and chain
$class::create()->foo();
2. Allow retrieving inherited classes and interfaces
3. Magic setter and getter with builtin functions
//set and get
$instance->setFooVar('hello world');
//returns nothing
$instance->getFooVar();
// returns hello world;
$instance->hasFooVar();
//returns true
$instance->hasBarVar();
//return false
//iterate if the content of fooVar is an Array and call the function parameter. If it's not an array it only call the callback with the value
$instance->withFooVar(function($value){});