/** * Get the raw data assigned to a key. * * @param string $key The key for which to get the stored item. * @param boolean $bail Throw an exception, if the key is not found * * @return \Joomla\DI\Resource * * @since __DEPLOY_VERSION__ * @throws KeyNotFoundException */ public function getResource($key, $bail = false) { if (isset($this->resources[$key])) { return $this->resources[$key]; } elseif ($this->parent instanceof Container) { return $this->parent->getResource($key); } elseif ($this->parent instanceof ContainerInterface && $this->parent->has($key)) { return new Resource($this, $this->parent->get($key), Resource::SHARE | Resource::PROTECT); } if ($bail) { throw new KeyNotFoundException(sprintf('Key %s has not been registered with the container.', $key)); } return null; }