public function determineContext($class, $grath = null) { if ($grath == 'default') { return $this->top; } else { return $this->top->determineContext($class, 'default'); } }
public function instantiate(Context $context, $nesting, $graph = null) { $graph = $this->graph ?: ($graph ?: 'default'); if (!isset($this->instance[$graph])) { $this->instance[$graph] = parent::instantiate($context->determineContext($this->class, $graph), $nesting, $graph); } return $this->instance[$graph]; }
public function determineContext($class, $graph = null) { $graph = $graph ?: 'default'; if (isset($this->contexts[$graph])) { foreach ($this->contexts[$graph] as $type => $context) { if ($this->repository()->isSupertype($class, $type)) { return $context; } } } return $this->parent->determineContext($class, $graph); }
public function instantiate(Context $context, $nesting, $graph = null) { $instances = []; foreach ($this->preferences as $preference) { if ($preference instanceof Lifecycle) { $preferContext = empty($preference->class) ? $context : $context->determineContext($preference->class, $graph); $instances[] = $preference->instantiate($preferContext, $nesting, $graph); } elseif (!is_string($preference)) { $instances[] = $preference; } else { $instances[] = $context->create($preference, $nesting, $graph); } } return $instances; }
public function instantiate(Context $context, $nesting, $graph = null) { return parent::instantiate($context->determineContext($this->class, $this->graph), $nesting, $this->graph); }