/** * @expectedException \Interop\Container\Exception\NotFoundException */ public function testGet() { // given $container = EmptyContainer::instance(); // when $container->get('foo'); // then $this->fail('unreachable'); }
/** * Create a new container chain from the given containers in order. * * @param array $containers the containers to chain * @return ContainerInterface */ public static function create(array $containers) { switch (count($containers)) { case 0: return EmptyContainer::instance(); case 1: return $containers[0]; default: $container = EmptyContainer::instance(); /** @var ContainerInterface $previous */ foreach (array_reverse($containers) as $previous) { $container = new self($previous, $container); } return $container; } }