@param \Spryker\Zed\CodeGenerator\Business\GeneratorProjectTypeResolver\GeneratorProjectTypeResolverInterface $typeResolver

@return string
778546
public function getDefaultYvesControllerSourceAction(GeneratorProjectTypeResolverInterface $typeResolver): string
    {
        if ($typeResolver->isDemoShop()) {
            return $this->getDemoShopDefaultYvesControllerSource();
        }

        return $this->getSuitDefaultYvesControllerSource();
    }
485461
public function configureOptions(OptionsResolver $resolver)
    {
        $this->fixDoctrineQueryBuilderNormalizer($resolver);

        $queryBuilder = function (EntityRepository $repository, $options) {
            $qb = $repository->createQueryBuilder('d');
            if (!empty($options['allowed_families'])) {
                /** @var FamilyInterface[] $families */
                $families = $options['allowed_families'];
                $familyCodes = [];
                foreach ($families as $family) {
                    $familyCodes[] = $family->getCode();
                }

                $qb
                    ->andWhere('d.family IN (:allowedFamilies)')
                    ->setParameter('allowedFamilies', $familyCodes);
            }
            $qb->setMaxResults($options['max_results']);

            return $qb;
        };

        $resolver->setDefaults(
            [
                'em' => $this->entityManager,
                'class' => $this->dataClass,
                'query_builder' => $queryBuilder,
                'max_results' => 100,
            ]
        );

        $this->allowedFamiliesOptionConfigurator->configureOptions($resolver);
    }
262894
public function resolve(string $typeName): string
    {
        if (!isset($this->cache[$typeName])) {
            foreach ($this->resourceNamespaces as $resourceNamespace) {
                if (class_exists($this->cache[$typeName] = $this->qualify($resourceNamespace, $typeName))) {
                    return $this->cache[$typeName];
                }
            }

            throw new ClassNotFoundException(
                sprintf(
                    "Did not find type '%s' in namespace(s) '%s'.",
                    $typeName,
                    implode(', ', $this->resourceNamespaces)
                )
            );
        }

        return $this->cache[$typeName];
    }
1045568
public function configureOptions(OptionsResolver $resolver)
    {
        $registry = $this->registry;

        $entityManagerNormalizer = function (Options $options, $entityManager) use ($registry) {
            if (null !== $entityManager) {
                if ($entityManager instanceof ObjectManager) {
                    return $entityManager;
                }

                return $registry->getManager($entityManager);
            }

            $entityManager = $registry->getManagerForClass($options['class']);

            if (null === $entityManager) {
                throw new RuntimeException(sprintf(
                    'Class "%s" seems not to be a managed Doctrine entity. Did you forget to map it?',
                    $options['class']
                ));
            }

            return $entityManager;
        };

        $compoundNormalizer = function () {
            return false;
        };

        $resolver->setDefaults([
            'entity_manager' => null,
        ]);

        $resolver->setRequired([
            'class',
        ]);

        $resolver->setNormalizer('entity_manager', $entityManagerNormalizer);
        $resolver->setNormalizer('compound', $compoundNormalizer);

        $resolver->setAllowedTypes('entity_manager', [
            'null',
            'string',
            ObjectManager::class,
        ]);
    }
879147
public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver
            ->setRequired(array(
                'field'
            ))
            ->setOptional(array(
                'sobject_type',
                'fieldname',
                'recordtype_id'
            ))
            ->setDefaults(array(
                'recordtype_id' => null,
                'field' => $this->fieldOption,
                'sobject_type' => function(Options $options)
                {
                    return $options['field']->getSobjectType();
                },
                'fieldname' => function(Options $options)
                {
                    return $options['field']->getName();
                },
                'field_type' => function(Options $options)
                {
                    return $options['field']->getType();
                },
                'required' => function(Options $options, $previous)
                {
                    if(null !== ($req= $options['field']->getRequired()))
                    {
                        return $req;
                    }
                    return $previous;
                },
                'label' => function(Options $options, $previous)
                {
                    if(null !== ($label = $options['field']->getLabel()))
                    {
                        return $label;
                    }
                    return $previous;
                },
                'read_only' => function(Options $options, $previous)
                {
                    if(null !== ($readonly = $options['field']->getReadonly()))
                    {
                        return $readonly;
                    }
                    return $previous;
                }
            ));
    }
1178803
public function getTransformer(?array $sourcesTypes, ?array $targetTypes, MapperConfigurationInterface $mapperConfiguration): ?TransformerInterface
    {
        if (null === $sourcesTypes || \count($sourcesTypes) === 0) {
            return null;
        }

        if (\count($sourcesTypes) > 1) {
            $transformer = new MultipleTransformer();

            foreach ($sourcesTypes as $sourceType) {
                $transformer->addTransformer($this->chainTransformerFactory->getTransformer([$sourceType], $targetTypes, $mapperConfiguration), $sourceType);
            }

            return $transformer;
        }

        return null;
    }
272380
protected function configureBaseOptions(OptionsResolver $resolver)
    {
        $resolver->setDefined([
            'content_type',
            'field',
            'publication_date',
            'section',
            'state',
        ]);
        $resolver->setDefaults([
            'sort' => [],
            'limit' => 25,
            'offset' => 0,
        ]);

        $resolver->setAllowedTypes('content_type', ['string', 'array']);
        $resolver->setAllowedTypes('section', ['string', 'array']);
        $resolver->setAllowedTypes('field', ['array']);
        $resolver->setAllowedTypes('limit', ['int']);
        $resolver->setAllowedTypes('offset', ['int']);
        $resolver->setAllowedTypes('publication_date', ['int', 'string', 'array']);
        $resolver->setAllowedTypes('state', ['array']);

        $identifierValuesCallback = function ($identifiers) {
            if (!is_array($identifiers)) {
                return true;
            }

            foreach ($identifiers as $identifier) {
                if (!is_string($identifier)) {
                    return false;
                }
            }

            return true;
        };

        $resolver->setAllowedValues('content_type', $identifierValuesCallback);
        $resolver->setAllowedValues('section', $identifierValuesCallback);
        $resolver->setAllowedValues(
            'publication_date',
            function ($dates) {
                if (!is_array($dates)) {
                    return true;
                }

                foreach ($dates as $date) {
                    if (!is_int($date) && !is_string($date)) {
                        return false;
                    }
                }

                return true;
            }
        );

        $class = SortClause::class;
        $resolver->setAllowedTypes('sort', ['string', $class, 'array']);
    }
244285
protected function getIdGeneratorTypeString($type)
    {
        if ( ! isset(static::$generatorStrategyMap[$type])) {
            throw new \InvalidArgumentException(sprintf('Invalid provided IdGeneratorType: %s', $type));
        }

        return static::$generatorStrategyMap[$type];
    }
960886
protected function generateCallCode($typeName, \ReflectionFunction $ref, $num, array $prepend = [], array $resolvers = NULL)
	{
		$code = '$this->call_' . $num . '(';
		
		foreach($ref->getParameters() as $i => $param)
		{
			if($i != 0)
			{
				$code .= ', ';
			}
			
			if(array_key_exists($i, $prepend))
			{
				$code .= $prepend[$i];
				
				continue;
			}
			
			if($resolvers !== NULL && array_key_exists($param->name, $resolvers))
			{
				$resolver = $resolvers[$param->name];
				
				if($resolver instanceof \Closure)
				{
					$num = count($this->methods);
						
					$ref = new \ReflectionFunction($resolver);
					$sig = $this->generateReplacementMethodSignature($ref, $num);
					$body = $this->extractClosureCode($ref);
					
					$this->methods[] = "\t\t" . $sig . " {\n" . $body . "\n\t\t}";
					
					$code .= $this->generateCallCode($typeName, $ref, $num);
					
					continue;
				}
				elseif($resolver instanceof CompiledCodeFragment)
				{
					$code .= $resolver;
					
					continue;
				}
				
				$code .= var_export($resolver, true);
				
				continue;
			}
			
			if(NULL !== ($ptype = $this->getParamType($param)))
			{
				if($ptype === InjectionPointInterface::class)
				{
					$code .= '$point';
					
					continue;
				}
				
				$code .= '$this->get(' . var_export($ptype, true) . ', isset($point) ? $point : NULL)';
				
				continue;
			}
			
			if($param->isOptional())
			{
				$code .= $param->isDefaultValueAvailable() ? var_export($param->getDefaultValue(), true) : 'NULL';
				
				continue;
			}
			
			throw new TypeNotFoundException(sprintf('Cannot populate closure param "%s" without type hint or resolver', $param->name));
		}
		
		return $code . ')';
	}
730863
public function generate(FileGenerator $file, $typeMap): string
    {
        $this->ruleSet->applyRules(new ClassMapContext($file, $typeMap, $this->name, $this->namespace));

        return $file->generate();
    }
177552
public function configureOptions (OptionsResolver $resolver)
    {
        $allRoles = $this->roleCollection->getAllAvailableRoles();
        $allRoleKeys = array_keys($allRoles);

        $resolver->setDefaults([
            "roles_with_tags" => [],
            "choices" => function(Options $options) use ($allRoleKeys, $allRoles)
            {
                // if no tags are selected, just return all roles
                if (empty($options["roles_with_tags"]))
                {
                    return array_combine($allRoleKeys, $allRoleKeys);
                }

                // if tags are selected, only use the choices with the given tags
                $choices = [];

                foreach ($allRoles as $roleKey => $role)
                {
                    if (!empty(array_intersect($options["roles_with_tags"], $role->getTags())))
                    {
                        $choices[$roleKey] = $roleKey;
                    }
                }

                return $choices;
            },
            "choices_as_values" => true,
            "choice_label" => function ($choiceValue, $choiceKey, $index) use ($allRoles)
            {
                return $allRoles[$choiceKey]->getTitle();
            },
            "choice_attr" => function ($choiceValue, $choiceKey, $index) use ($allRoles)
            {
                return [
                    "data-role-description" => $allRoles[$choiceKey]->getDescription(),
                ];
            },
        ]);

        $resolver->setAllowedTypes("roles_with_tags", ["array"]);
    }
534262
private function getMapping(TypeInterface $type)
    {
        $type = (string) $type->getType();

        if (!isset($this->mappings[$type])) {
            throw new \InvalidArgumentException(sprintf('The mapping for type "%s" could not be found.', $type));
        }

        return $this->mappings[$type];
    }
1090061
public function createBuilder($typeClass = DataTableType::class, array $options = array())
    {
        $type = $this->createType($typeClass);

        $dt = new DataTable($this->container);
        $resolver = new OptionsResolver();
        $dt->configureOptions($resolver);
        $type->configureOptions($resolver);
        $options = $resolver->resolve($options);

        $builder = new DataTableBuilder($this->container, $options);
        $type->buildDataTable($builder, $options);

        return $builder;
    }
707174
private function getResolver(): OptionsResolver
    {
        if (!is_null($this->resolver)) {
            return $this->resolver;
        }

        $this->resolver = $this->buildResolver();

        return $this->resolver;
    }
232233
protected function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setRequired(
            [
                'family',
            ]
        );
        /** @noinspection PhpUnusedParameterInspection */
        $resolver->setNormalizer(
            'family',
            function (Options $options, $value) {
                if ($value instanceof FamilyInterface) {
                    return $value;
                }

                return $this->familyRegistry->getFamily($value);
            }
        );
        $resolver->setAllowedTypes('family', ['string', FamilyInterface::class]);
    }
429688
public function getDispatcherFactory(ContainerInterface $container): DispatcherFactoryInterface
    {
        $autowired = $container->get('ellipse.dispatcher.autowiring.status');

        if ($autowired) {

            $interfaces = $container->get('ellipse.dispatcher.autowiring.interfaces');

            $container = new ReflectionContainer($container, $interfaces);

        }

        return new DefaultResolver($container);
    }
325107
private function getClassType($node, TypeInterface $parent): string
    {
        $phpFile = RootRetrieverHelper::getRoot($parent);

        switch (true) {
            case $node instanceof Node\Identifier:
            case $node->isRelative():
            case $node->isUnqualified():
                $name = $this->getUnqualifiedClassType($node, $phpFile);
                break;
            case $node->isFullyQualified():
                $name = $node->toString();
                break;
            case $node->isQualified():
                $name = $this->getQualifiedClassType($node, $phpFile);
                break;
            default:
                return TypeInterface::UNKNOWN_CUSTOM;
        }

        // Get the last name part
        $nameArray = explode('\\', $name);
        $lastPart  = end($nameArray);

        $phpFile->addConcreteUse($name, $lastPart);

        return $lastPart;
    }