* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form; /** * The default implementation of FormFactoryBuilderInterface. * * @author Bernhard Schussek */ class FormFactoryBuilder implements FormFactoryBuilderInterface { /** * @var ResolvedFormTypeFactoryInterface */ private $resolvedTypeFactory; /** * @var FormExtensionInterface[] */ private $extensions = array(); /** * @var FormTypeInterface[] */ private $types = array(); /** * @var FormTypeExtensionInterface[] */ private $typeExtensions = array(); /** * @var FormTypeGuesserInterface[] */ private $typeGuessers = array(); /** * {@inheritdoc} */ public function setResolvedTypeFactory(ResolvedFormTypeFactoryInterface $resolvedTypeFactory) { $this->resolvedTypeFactory = $resolvedTypeFactory; return $this; } /** * {@inheritdoc} */ public function addExtension(FormExtensionInterface $extension) { $this->extensions[] = $extension; return $this; } /** * {@inheritdoc} */ public function addExtensions(array $extensions) { $this->extensions = array_merge($this->extensions, $extensions); return $this; } /** * {@inheritdoc} */ public function addType(FormTypeInterface $type) { $this->types[] = $type; return $this; } /** * {@inheritdoc} */ public function addTypes(array $types) { foreach ($types as $type) { $this->types[] = $type; } return $this; } /** * {@inheritdoc} */ public function addTypeExtension(FormTypeExtensionInterface $typeExtension) { $this->typeExtensions[$typeExtension->getExtendedType()][] = $typeExtension; return $this; } /** * {@inheritdoc} */ public function addTypeExtensions(array $typeExtensions) { foreach ($typeExtensions as $typeExtension) { $this->typeExtensions[$typeExtension->getExtendedType()][] = $typeExtension; } return $this; } /** * {@inheritdoc} */ public function addTypeGuesser(FormTypeGuesserInterface $typeGuesser) { $this->typeGuessers[] = $typeGuesser; return $this; } /** * {@inheritdoc} */ public function addTypeGuessers(array $typeGuessers) { $this->typeGuessers = array_merge($this->typeGuessers, $typeGuessers); return $this; } /** * {@inheritdoc} */ public function getFormFactory() { $extensions = $this->extensions; if (count($this->types) > 0 || count($this->typeExtensions) > 0 || count($this->typeGuessers) > 0) { if (count($this->typeGuessers) > 1) { $typeGuesser = new FormTypeGuesserChain($this->typeGuessers); } else { $typeGuesser = isset($this->typeGuessers[0]) ? $this->typeGuessers[0] : null; } $extensions[] = new PreloadedExtension($this->types, $this->typeExtensions, $typeGuesser); } $registry = new FormRegistry($extensions, $this->resolvedTypeFactory ?: new ResolvedFormTypeFactory()); return new FormFactory($registry); } } __halt_compiler();----SIGNATURE:----d5wziicn/fMa3Md7HY6jbxCrPthSWUjlk4ol/rqjADYeAcsNQSuBZXKt+hDgXGLAANd3LjsuBGhImbMmHVvf4Fuaq8hEB42KctA8KPg6GeopWLOX2tjfrGNq56eDIvYnUxy8bH/PRtlKfXcMOcEx0hI6GR16ZJshuGw6rw0wh4I03gNEHJ1lv11hJaV2cAYknsbL5KGT8Wefxu5S/1bZgYLqVV7xJcNqnvT+lX0tVBju6pSZWqrH9Q0tdO72nLPrQJ/xyBqRGk3PazCbovx3gjvxEY5NF6Do7SDY9YVEzyWOEI7sgzIZDQ9hrHcYIwDOOqBnEhmPT8Pti35V+lA56DgduupYb1E2TovTMHsL6wDQ3pR9oRUg/ONn76VsY8C+pYMUSZuF2Y1W1a9B95gAJmPtomip1nXX5YUg8m4y15km6oMNzGrXncYAPZdIzvICsC1I1u4kD7KUyHy/N0QWCbawqlulrbpOaTyIjQjoqv3jCQ1rARU5m14bg1za/37wLK48U1wtvWeOky3NZqoM98qE4KcW+VkDE9Fa0llHXbM/0a7Pq7pRyeCybTj1chTcpas0EpF5OV57t0UOlPkFUQ6OZj/T7rBY1RHa8HfVI9AqXxT45nEePDfwSETrkhPQ3heLqRaNhwmBd+O9qAVwcNfhpHz6nMzYv9TlX4mpG1Y=----ATTACHMENT:----NjM3MDc4NzgwMDU5NDQyNiA2Nzc5MzgyMzQ1NjAyMzc3IDYyOTQyMDM5NDk4NDcyMTU=