2023-06-19 12:13:30 +02:00
< ? php
namespace Symfony\Config\Framework ;
require_once __DIR__ . \DIRECTORY_SEPARATOR . 'Form' . \DIRECTORY_SEPARATOR . 'CsrfProtectionConfig.php' ;
use Symfony\Component\Config\Loader\ParamConfigurator ;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException ;
/**
* This class is automatically generated to help in creating a config .
*/
class FormConfig
{
private $enabled ;
private $csrfProtection ;
private $legacyErrorMessages ;
private $_usedProperties = [];
/**
2023-06-20 19:14:19 +02:00
* @ default true
2023-06-19 12:13:30 +02:00
* @ param ParamConfigurator | bool $value
* @ return $this
*/
public function enabled ( $value ) : static
{
$this -> _usedProperties [ 'enabled' ] = true ;
$this -> enabled = $value ;
return $this ;
}
public function csrfProtection ( array $value = []) : \Symfony\Config\Framework\Form\CsrfProtectionConfig
{
if ( null === $this -> csrfProtection ) {
$this -> _usedProperties [ 'csrfProtection' ] = true ;
$this -> csrfProtection = new \Symfony\Config\Framework\Form\CsrfProtectionConfig ( $value );
} elseif ( 0 < \func_num_args ()) {
throw new InvalidConfigurationException ( 'The node created by "csrfProtection()" has already been initialized. You cannot pass values the second time you call csrfProtection().' );
}
return $this -> csrfProtection ;
}
/**
* @ default null
* @ param ParamConfigurator | bool $value
* @ return $this
*/
public function legacyErrorMessages ( $value ) : static
{
$this -> _usedProperties [ 'legacyErrorMessages' ] = true ;
$this -> legacyErrorMessages = $value ;
return $this ;
}
public function __construct ( array $value = [])
{
if ( array_key_exists ( 'enabled' , $value )) {
$this -> _usedProperties [ 'enabled' ] = true ;
$this -> enabled = $value [ 'enabled' ];
unset ( $value [ 'enabled' ]);
}
if ( array_key_exists ( 'csrf_protection' , $value )) {
$this -> _usedProperties [ 'csrfProtection' ] = true ;
$this -> csrfProtection = new \Symfony\Config\Framework\Form\CsrfProtectionConfig ( $value [ 'csrf_protection' ]);
unset ( $value [ 'csrf_protection' ]);
}
if ( array_key_exists ( 'legacy_error_messages' , $value )) {
$this -> _usedProperties [ 'legacyErrorMessages' ] = true ;
$this -> legacyErrorMessages = $value [ 'legacy_error_messages' ];
unset ( $value [ 'legacy_error_messages' ]);
}
if ([] !== $value ) {
throw new InvalidConfigurationException ( sprintf ( 'The following keys are not supported by "%s": ' , __CLASS__ ) . implode ( ', ' , array_keys ( $value )));
}
}
public function toArray () : array
{
$output = [];
if ( isset ( $this -> _usedProperties [ 'enabled' ])) {
$output [ 'enabled' ] = $this -> enabled ;
}
if ( isset ( $this -> _usedProperties [ 'csrfProtection' ])) {
$output [ 'csrf_protection' ] = $this -> csrfProtection -> toArray ();
}
if ( isset ( $this -> _usedProperties [ 'legacyErrorMessages' ])) {
$output [ 'legacy_error_messages' ] = $this -> legacyErrorMessages ;
}
return $output ;
}
}