public function instantiate(Context $context, $nesting, $graph = null) { array_unshift($nesting, $this->class); $dependencies = $context->createDependencies($context->repository()->getConstructorParameters($this->class), $nesting, $graph); $instance = call_user_func_array(array(new \ReflectionClass($this->class), 'newInstance'), $dependencies); $context->invokeSetters($context, $nesting, $this->class, $instance, $graph); return $instance; }
function instantiate(Context $context, $nesting, $graph = null) { @session_start(); if (!isset($_SESSION[$this->slot])) { array_unshift($nesting, $this->class); $dependencies = $context->createDependencies($context->repository()->getConstructorParameters($this->class), $nesting); $_SESSION[$this->slot] = call_user_func_array(array(new ReflectionClass($this->class), 'newInstance'), $dependencies); } return $_SESSION[$this->slot]; }
public function invokeSetters(Context $context, $nesting, $class, $instance, $graph = null) { foreach ($context->settersFor($class) as $setter) { array_unshift($nesting, $class); $context->invoke($instance, $setter, $context->createDependencies($this->repository()->getParameters($class, $setter), $nesting, $graph)); } }