* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form; use Symfony\Component\Form\Exception\InvalidArgumentException; /** * A form extension with preloaded types, type extensions and type guessers. * * @author Bernhard Schussek */ class PreloadedExtension implements FormExtensionInterface { private $types = array(); private $typeExtensions = array(); private $typeGuesser; /** * Creates a new preloaded extension. * * @param FormTypeInterface[] $types The types that the extension should support * @param FormTypeExtensionInterface[][] $typeExtensions The type extensions that the extension should support * @param FormTypeGuesserInterface|null $typeGuesser The guesser that the extension should support */ public function __construct(array $types, array $typeExtensions, FormTypeGuesserInterface $typeGuesser = null) { $this->typeExtensions = $typeExtensions; $this->typeGuesser = $typeGuesser; foreach ($types as $type) { $this->types[get_class($type)] = $type; } } /** * {@inheritdoc} */ public function getType($name) { if (!isset($this->types[$name])) { throw new InvalidArgumentException(sprintf('The type "%s" can not be loaded by this extension', $name)); } return $this->types[$name]; } /** * {@inheritdoc} */ public function hasType($name) { return isset($this->types[$name]); } /** * {@inheritdoc} */ public function getTypeExtensions($name) { return isset($this->typeExtensions[$name]) ? $this->typeExtensions[$name] : array(); } /** * {@inheritdoc} */ public function hasTypeExtensions($name) { return !empty($this->typeExtensions[$name]); } /** * {@inheritdoc} */ public function getTypeGuesser() { return $this->typeGuesser; } } __halt_compiler();----SIGNATURE:----An053mgXrNHU7GRTAJl1Yas1BHiVYjP/tmCrdVNVyrO485Te5NeXgH9BOt1hdACtufD/ExUoCKJbEAlpVGCHznArchWhOQiezkZ42zEYE6JB+KdoDOJJ0wJKdOHMS315XW85mZ1MhNJEVIqDj2wY1Y7aU8obqonl2AqNTSY/YWN1qwMsYAEwJ9lUiKINt0896usFKK4MFl628uthw4L97neUQXjmKhJ3ELfYqdWU4x5TCCurDxEcg91ER6fxxG3QbF/7N8kY1qJHxVEUo2VN/XO+uwHrsTax5O4GzAwKrQwsLVr/Uzs8R4+cAMQhSdytsCOa4GS4ZXzbc7+h/vTnTrLwQ/zBTeQ6gK8CCaV36uFBc72vyphrBvsAvC0HTMd8Y3C3yWbXsrgcK7NVBUv8MPNTjrxIMwfk4SrAIh2/68Ibu1AK8KU+8gEnQ3LEC4bzHLAa8WtGoTLJiHZGNJbeWv0R4d9wvvGSUMjWVaSu8TqfhJkUvnZ4nPgB6wS/RMqGLUFCru3u9m5/kSpkyhnCjJXkkh2iF3GweyPevYIrB5j/EP/FLeDNcux076m8V55NGasgQdJyC8PlIApNPsxabNTRYFrk2kRJkSS1fFQK2L6A4aHkQtXGbdnOhXarZPG66rIf/rI4q/SvmSJd/DX6KZMlkZ9mqBlEQ1Ywuh0v4e8=----ATTACHMENT:----NDkwMjkwNDE4Mzc2MTIzMCA5NjYyNTg1NTA3MTU0MTgyIDc5MzIzMDI1NjIzNjg2NzY=