CsrfStep.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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\Bundle\WebConfiguratorBundle\Step;
  11. use Symfony\Bundle\WebConfiguratorBundle\Exception\StepRequirementException;
  12. use Symfony\Bundle\WebConfiguratorBundle\Form\CsrfStepType;
  13. /**
  14. * Csrf Step.
  15. *
  16. * @author Fabien Potencier <fabien@symfony.com>
  17. */
  18. class CsrfStep implements StepInterface
  19. {
  20. /**
  21. * @assert:NotBlank
  22. */
  23. public $csrf_secret;
  24. public function __construct(array $parameters)
  25. {
  26. $this->csrf_secret = $parameters['csrf_secret'];
  27. }
  28. /**
  29. * @see StepInterface
  30. */
  31. public function getFormType()
  32. {
  33. return new CsrfStepType();
  34. }
  35. /**
  36. * @see StepInterface
  37. */
  38. public function checkRequirements()
  39. {
  40. return array();
  41. }
  42. /**
  43. * checkOptionalSettings
  44. */
  45. public function checkOptionalSettings()
  46. {
  47. return array();
  48. }
  49. /**
  50. * @see StepInterface
  51. */
  52. public function update(StepInterface $data)
  53. {
  54. return array('csrf_secret' => $data->csrf_secret);
  55. }
  56. /**
  57. * @see StepInterface
  58. */
  59. public function getTemplate()
  60. {
  61. return 'SymfonyWebConfiguratorBundle:Step:csrf.html.twig';
  62. }
  63. }