addContainer($container); } } /** * Adds a container to an internal queue of containers * * @param ContainerInterface $container The container to add * * @return $this */ public function addContainer(ContainerInterface $container) { $this->containers[] = $container; return $this; } /** * Finds an entry of the container by delegating the get call to a FIFO queue of internal containers * * {@inheritDoc} */ public function get($id) { foreach ($this->containers as $container) { if ($container->has($id)) { return $container->get($id); } } throw NotFoundException::fromPrevious($id); } /** * Returns true if the at least one of the internal containers can return an entry for the given identifier * Returns false otherwise. * * {@inheritDoc} */ public function has($id) { foreach ($this->containers as $container) { if ($container->has($id)) { return true; } } return false; } }