Exemple #1
0
 /**
  * Get a service that has been registered in this container.
  *
  * @param  string $alias
  * @param  array $args
  * @return mixed
  */
 protected function getFromThisContainer($alias, array $args = [])
 {
     if ($this->hasShared($alias, true)) {
         return $this->inflectors->inflect($this->shared[$alias]);
     }
     if (array_key_exists($alias, $this->sharedDefinitions)) {
         $shared = $this->inflectors->inflect($this->sharedDefinitions[$alias]->build());
         $this->shared[$alias] = $shared;
         return $shared;
     }
     if (array_key_exists($alias, $this->definitions)) {
         return $this->inflectors->inflect($this->definitions[$alias]->build($args));
     }
     return false;
 }
Exemple #2
0
 /**
  * {@inheritdoc}
  */
 public function inflector($type, callable $callback = null)
 {
     return $this->inflectors->add($type, $callback);
 }