Example #1
0
    public function get()
    {
       return  $this->_some;
    }
}

trait Call
{
    public function __call($method, $args)
    {
        $reflection = new ReflectionObject($this);
        foreach ($reflection->getProperties() as $property) {
            $transformedPropertyName = str_replace('_', '', $property->getName());
            $property->getName();
            current($args);
        }
    }
}

class A {
    use Hello, Call;

    protected $_name = '';
}

$a = new A();
$a->set('cal');
$a->get();
$a->setName('Jo');

Example #2
0
File: index.php Project: arhcmf/1
$DI = new DI();
class A
{
    function __construct(DI $DI)
    {
        $this->B = $DI->get('B');
    }
    function get()
    {
        return $this->B->get();
    }
}
class B
{
    function get()
    {
        return __CLASS__;
    }
}
class B2
{
    function get()
    {
        echo __CLASS__;
    }
}
$A = new A((new $DI())->set(['B' => new B2()]));
echo $A->get();
$A = new A($DI);
echo $A->get();
exit;