/**
  * @param object $container
  *
  * @throws UnknownContainerException
  * @throws NotContainerAdapterException
  *
  * @return ContainerAdapter
  */
 public function create($container)
 {
     $class = '';
     foreach ($this->config as $containerClass => $configuratorClass) {
         if ($container instanceof $containerClass) {
             $class = $configuratorClass;
             break;
         }
     }
     if (!$class) {
         throw UnknownContainerException::fromContainerName(get_class($container), array_keys($this->config));
     }
     $instance = new $class();
     if (!$instance instanceof ContainerAdapter) {
         throw NotContainerAdapterException::fromClassName($class);
     }
     $instance->setContainer($container);
     return $instance;
 }
 public function testItCanBeCreatedFromFileExtension()
 {
     $exception = UnknownContainerException::fromContainerName('example-container', ['container-a', 'container-b']);
     assertSame('Container example-container is unknown; known containers are ["container-a", "container-b"].', $exception->getMessage());
 }