Пример #1
0
 /**
  * Get the raw object prior to resolution.
  *
  * @param string $binding The $binding key to get the raw value from.
  *
  * @return mixed Value of the $binding.
  */
 public function getRaw($binding)
 {
     if (isset($this->bindings[$binding])) {
         return $this->bindings[$binding];
     } elseif (isset($this->parent)) {
         return $this->parent->getRaw($binding);
     }
     return null;
 }
Пример #2
0
 /**
  * Get the raw data assigned to a key.
  *
  * @param   string  $key  The key for which to get the stored item.
  *
  * @return  mixed
  *
  * @since   1.0
  */
 protected function getRaw($key)
 {
     $key = $this->resolveAlias($key);
     if (isset($this->dataStore[$key])) {
         return $this->dataStore[$key];
     } elseif ($this->parent instanceof Container) {
         return $this->parent->getRaw($key);
     }
     return null;
 }
Пример #3
0
 /**
  * Add methods and args from inherited classes/interfaces
  *
  * @return void
  */
 protected function mergeInheritedDependencies()
 {
     $reflection = new \ReflectionClass($this->class);
     $inheritance = $reflection->getInterfaceNames();
     $class = $reflection;
     while ($parent = $class->getParentClass()) {
         $inheritance[] = $parent->getName();
         $class = $parent;
     }
     foreach ($inheritance as $interface) {
         $interface = $this->container->getRaw($interface);
         if ($interface instanceof static and $interface->inherit()) {
             $this->addArgs($interface->getArgs());
             $this->withMethods($interface->getMethods());
         }
     }
 }