function let(KernelWrapper $kernel, BundleInterface $bundle1, BundleInterface $bundle2, ServiceNameGenerator $generator)
 {
     $kernel->getBundles()->willReturn([$bundle1, $bundle2]);
     $this->beConstructedWith($kernel, $generator);
     $bundle1->getNamespace()->willReturn('Company\\MyBundle');
     $bundle1->getName()->willReturn('bundle1');
     $bundle2->getNamespace()->willReturn('Company\\MyOther\\Bundle');
     $bundle2->getName()->willReturn('Bundle2');
 }
 /**
  * {@inheritdoc}
  */
 public function generateFromClassname($classname)
 {
     $bundles = $this->kernel->getBundles();
     foreach ($bundles as $bundle) {
         if (0 !== strpos($classname, $bundle->getNamespace())) {
             continue;
         }
         $classname = sprintf('%s\\%s', Inflector::classify($bundle->getName()), trim(substr($classname, strlen($bundle->getNamespace())), '\\'));
     }
     return $this->generator->generateFromClassname($classname);
 }
 /**
  * {@inheritdoc}
  */
 public function buildDefinitions(array $config)
 {
     $config = array_merge(['public' => false], $config);
     $definitions = [];
     $voters = $this->finder->findClasses($this->kernel->getBundles(), 'Security', 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface');
     foreach ($voters as $voter) {
         if (false === $this->analyzer->canBeConstructed($voter)) {
             continue;
         }
         $definitions[$voter] = (new Definition())->setClass($voter)->setPublic($config['public'])->addTag('security.voter');
     }
     return $definitions;
 }
 /**
  * {@inheritdoc}
  */
 public function buildDefinitions(array $config)
 {
     $config = array_merge(['public' => false], $config);
     $definitions = [];
     $validators = $this->finder->findClasses($this->kernel->getBundles(), ['Validator', 'Validation'], 'Symfony\\Component\\Validator\\Violation\\ConstraintViolationBuilderInterface');
     foreach ($validators as $validator) {
         if (false === $this->analyzer->canBeConstructed($validator)) {
             continue;
         }
         $definitions[$validator] = (new Definition())->setClass($validator)->setPublic($config['public'])->addTag('validator.constraint_validator', ['alias_name' => $this->buildAlias($validator)]);
     }
     return $definitions;
 }
 /**
  * {@inheritdoc}
  */
 public function buildDefinitions(array $config)
 {
     $config = array_merge(['public' => false], $config);
     $definitions = [];
     $twigExtensions = $this->finder->findClasses($this->kernel->getBundles(), ['Twig', 'Templating'], 'Twig_Extension');
     foreach ($twigExtensions as $twigExtension) {
         if (false === $this->analyzer->canBeConstructed($twigExtension)) {
             continue;
         }
         $definitions[$twigExtension] = (new Definition())->setClass($twigExtension)->setPublic($config['public'])->addTag('twig.extension');
     }
     return $definitions;
 }
 /**
  * {@inheritdoc}
  */
 public function buildDefinitions(array $config)
 {
     $config = array_merge(['public' => false], $config);
     $definitions = [];
     $types = $this->finder->findClasses($this->kernel->getBundles(), 'Form', 'Symfony\\Component\\Form\\FormTypeExtensionInterface');
     foreach ($types as $type) {
         if (false === $this->analyzer->canBeConstructed($type)) {
             continue;
         }
         $instance = new $type();
         $definitions[$type] = (new Definition())->setClass($type)->setPublic($config['public'])->addTag('form.type_extension', ['extended_type' => $instance->getExtendedType()]);
     }
     return $definitions;
 }
 /**
  * {@inheritdoc}
  */
 public function buildDefinitions(array $config)
 {
     $config = array_merge(['public' => false], $config);
     $definitions = [];
     $objects = $this->finder->findClasses($this->kernel->getBundles(), ['Entity', 'Document', 'Model']);
     foreach ($objects as $object) {
         try {
             if (null === $this->om->getManagerForClass($object)) {
                 continue;
             }
         } catch (ConnectionException $ex) {
             unset($ex);
         }
         $definitions[sprintf('%sRepository', $object)] = (new Definition())->setClass('Doctrine\\Common\\Persistence\\ObjectRepository')->setPublic($config['public'])->setFactory([new Reference($this->name), 'getRepository'])->addArgument($object);
     }
     return $definitions;
 }