/**
  * @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 testItCanBeCreatedFromThePatterns()
 {
     assertSame('Class "Foo" is not a container adapter.', NotContainerAdapterException::fromClassName('Foo')->getMessage());
 }