Deprecated: Return type of Google\Model::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Model.php on line 256

Deprecated: Return type of Google\Model::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Model.php on line 261

Deprecated: Return type of Google\Model::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Model.php on line 268

Deprecated: Return type of Google\Model::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Model.php on line 278

Deprecated: Return type of Google\Collection::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 22

Deprecated: Return type of Google\Collection::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 38

Deprecated: Return type of Google\Collection::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 30

Deprecated: Return type of Google\Collection::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 43

Deprecated: Return type of Google\Collection::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 14

Deprecated: Return type of Google\Collection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 49
Symfony Profiler

vendor/symfony/form/Extension/Core/Type/FormType.php line 75

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Component\Form\Extension\Core\Type;
  11. use Symfony\Component\Form\Exception\LogicException;
  12. use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
  13. use Symfony\Component\Form\Extension\Core\EventListener\TrimListener;
  14. use Symfony\Component\Form\FormBuilderInterface;
  15. use Symfony\Component\Form\FormConfigBuilderInterface;
  16. use Symfony\Component\Form\FormInterface;
  17. use Symfony\Component\Form\FormView;
  18. use Symfony\Component\OptionsResolver\Options;
  19. use Symfony\Component\OptionsResolver\OptionsResolver;
  20. use Symfony\Component\PropertyAccess\PropertyAccess;
  21. use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
  22. class FormType extends BaseType
  23. {
  24.     private $propertyAccessor;
  25.     public function __construct(PropertyAccessorInterface $propertyAccessor null)
  26.     {
  27.         $this->propertyAccessor $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
  28.     }
  29.     /**
  30.      * {@inheritdoc}
  31.      */
  32.     public function buildForm(FormBuilderInterface $builder, array $options)
  33.     {
  34.         parent::buildForm($builder$options);
  35.         $isDataOptionSet \array_key_exists('data'$options);
  36.         $builder
  37.             ->setRequired($options['required'])
  38.             ->setErrorBubbling($options['error_bubbling'])
  39.             ->setEmptyData($options['empty_data'])
  40.             ->setPropertyPath($options['property_path'])
  41.             ->setMapped($options['mapped'])
  42.             ->setByReference($options['by_reference'])
  43.             ->setInheritData($options['inherit_data'])
  44.             ->setCompound($options['compound'])
  45.             ->setData($isDataOptionSet $options['data'] : null)
  46.             ->setDataLocked($isDataOptionSet)
  47.             ->setDataMapper($options['compound'] ? new PropertyPathMapper($this->propertyAccessor) : null)
  48.             ->setMethod($options['method'])
  49.             ->setAction($options['action']);
  50.         if ($options['trim']) {
  51.             $builder->addEventSubscriber(new TrimListener());
  52.         }
  53.         if (!method_exists($builder'setIsEmptyCallback')) {
  54.             trigger_deprecation('symfony/form''5.1''Not implementing the "%s::setIsEmptyCallback()" method in "%s" is deprecated.'FormConfigBuilderInterface::class, get_debug_type($builder));
  55.             return;
  56.         }
  57.         $builder->setIsEmptyCallback($options['is_empty_callback']);
  58.     }
  59.     /**
  60.      * {@inheritdoc}
  61.      */
  62.     public function buildView(FormView $viewFormInterface $form, array $options)
  63.     {
  64.         parent::buildView($view$form$options);
  65.         $name $form->getName();
  66.         $helpTranslationParameters $options['help_translation_parameters'];
  67.         if ($view->parent) {
  68.             if ('' === $name) {
  69.                 throw new LogicException('Form node with empty name can be used only as root form node.');
  70.             }
  71.             // Complex fields are read-only if they themselves or their parents are.
  72.             if (!isset($view->vars['attr']['readonly']) && isset($view->parent->vars['attr']['readonly']) && false !== $view->parent->vars['attr']['readonly']) {
  73.                 $view->vars['attr']['readonly'] = true;
  74.             }
  75.             $helpTranslationParameters array_merge($view->parent->vars['help_translation_parameters'], $helpTranslationParameters);
  76.         }
  77.         $formConfig $form->getConfig();
  78.         $view->vars array_replace($view->vars, [
  79.             'errors' => $form->getErrors(),
  80.             'valid' => $form->isSubmitted() ? $form->isValid() : true,
  81.             'value' => $form->getViewData(),
  82.             'data' => $form->getNormData(),
  83.             'required' => $form->isRequired(),
  84.             'size' => null,
  85.             'label_attr' => $options['label_attr'],
  86.             'help' => $options['help'],
  87.             'help_attr' => $options['help_attr'],
  88.             'help_html' => $options['help_html'],
  89.             'help_translation_parameters' => $helpTranslationParameters,
  90.             'compound' => $formConfig->getCompound(),
  91.             'method' => $formConfig->getMethod(),
  92.             'action' => $formConfig->getAction(),
  93.             'submitted' => $form->isSubmitted(),
  94.         ]);
  95.     }
  96.     /**
  97.      * {@inheritdoc}
  98.      */
  99.     public function finishView(FormView $viewFormInterface $form, array $options)
  100.     {
  101.         $multipart false;
  102.         foreach ($view->children as $child) {
  103.             if ($child->vars['multipart']) {
  104.                 $multipart true;
  105.                 break;
  106.             }
  107.         }
  108.         $view->vars['multipart'] = $multipart;
  109.     }
  110.     /**
  111.      * {@inheritdoc}
  112.      */
  113.     public function configureOptions(OptionsResolver $resolver)
  114.     {
  115.         parent::configureOptions($resolver);
  116.         // Derive "data_class" option from passed "data" object
  117.         $dataClass = function (Options $options) {
  118.             return isset($options['data']) && \is_object($options['data']) ? \get_class($options['data']) : null;
  119.         };
  120.         // Derive "empty_data" closure from "data_class" option
  121.         $emptyData = function (Options $options) {
  122.             $class $options['data_class'];
  123.             if (null !== $class) {
  124.                 return function (FormInterface $form) use ($class) {
  125.                     return $form->isEmpty() && !$form->isRequired() ? null : new $class();
  126.                 };
  127.             }
  128.             return function (FormInterface $form) {
  129.                 return $form->getConfig()->getCompound() ? [] : '';
  130.             };
  131.         };
  132.         // Wrap "post_max_size_message" in a closure to translate it lazily
  133.         $uploadMaxSizeMessage = function (Options $options) {
  134.             return function () use ($options) {
  135.                 return $options['post_max_size_message'];
  136.             };
  137.         };
  138.         // For any form that is not represented by a single HTML control,
  139.         // errors should bubble up by default
  140.         $errorBubbling = function (Options $options) {
  141.             return $options['compound'] && !$options['inherit_data'];
  142.         };
  143.         // If data is given, the form is locked to that data
  144.         // (independent of its value)
  145.         $resolver->setDefined([
  146.             'data',
  147.         ]);
  148.         $resolver->setDefaults([
  149.             'data_class' => $dataClass,
  150.             'empty_data' => $emptyData,
  151.             'trim' => true,
  152.             'required' => true,
  153.             'property_path' => null,
  154.             'mapped' => true,
  155.             'by_reference' => true,
  156.             'error_bubbling' => $errorBubbling,
  157.             'label_attr' => [],
  158.             'inherit_data' => false,
  159.             'compound' => true,
  160.             'method' => 'POST',
  161.             // According to RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt)
  162.             // section 4.2., empty URIs are considered same-document references
  163.             'action' => '',
  164.             'attr' => [],
  165.             'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.',
  166.             'upload_max_size_message' => $uploadMaxSizeMessage// internal
  167.             'allow_file_upload' => false,
  168.             'help' => null,
  169.             'help_attr' => [],
  170.             'help_html' => false,
  171.             'help_translation_parameters' => [],
  172.             'is_empty_callback' => null,
  173.         ]);
  174.         $resolver->setAllowedTypes('label_attr''array');
  175.         $resolver->setAllowedTypes('action''string');
  176.         $resolver->setAllowedTypes('upload_max_size_message', ['callable']);
  177.         $resolver->setAllowedTypes('help', ['string''null']);
  178.         $resolver->setAllowedTypes('help_attr''array');
  179.         $resolver->setAllowedTypes('help_html''bool');
  180.         $resolver->setAllowedTypes('is_empty_callback', ['null''callable']);
  181.     }
  182.     /**
  183.      * {@inheritdoc}
  184.      */
  185.     public function getParent()
  186.     {
  187.         return null;
  188.     }
  189.     /**
  190.      * {@inheritdoc}
  191.      */
  192.     public function getBlockPrefix()
  193.     {
  194.         return 'form';
  195.     }
  196. }