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]; }
/** * @return ClassRepository */ function repository() { return $this->parent->repository(); }