, ?:)
. , .:) :
$ordinary = new stdClass();
$ordinary->Caption = 'Hello';
class Awesome
{
private $ordinary;
public function __construct($ordinary) {
$this->ordinary = (array) $ordinary;
}
public function __get($name) {
$value = '';
return $this->ordinary[$name];
}
}
class Lovely extends Awesome
{
public function __get($name)
{
return '<3 ' . parent::__get($name) . ' <3';
}
}
, , -.
, , API . stdClass.
, -. , . API, :
$awesome = new Awesome($ordinary);
echo $awesome->Caption, "\n";
API:
$lovely = new Lovely($ordinary);
echo $lovely->Caption, "\n";
, Lovely, Awesome, Awesome :
$awesome = $ordinary;
, API . Lovely, ( ), , : Lovely , Awesome, ( ) __get :
public function __get($name)
{
return '<3 ' . parent::__get($name) . ' <3';
}
, Awesome - API, , , .
, , API . API , .
, / . API, , , [] ->. , ;)
, :
echo $store->getObject('product')->getPrice($currency);