| Total Complexity | 4 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Coverage | 80% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | final class CsrfValueValidator implements ValueValidatorInterface |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * Invalidate the token after verification ? |
||
| 18 | * |
||
| 19 | * @var boolean |
||
| 20 | */ |
||
| 21 | private $invalidate; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * The constraint options |
||
| 25 | * |
||
| 26 | * @var array |
||
| 27 | */ |
||
| 28 | private $options; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * CsrfValueValidator constructor. |
||
| 32 | * |
||
| 33 | * @param bool $invalidate Always invalidate the token after validation |
||
| 34 | * @param array $options Constraints options |
||
| 35 | */ |
||
| 36 | 21 | public function __construct(bool $invalidate = false, array $options = []) |
|
| 37 | { |
||
| 38 | 21 | $this->invalidate = $invalidate; |
|
| 39 | 21 | $this->options = $options; |
|
| 40 | 21 | } |
|
| 41 | |||
| 42 | /** |
||
| 43 | * {@inheritdoc} |
||
| 44 | * |
||
| 45 | * @param CsrfElement $element |
||
| 46 | * @psalm-suppress MoreSpecificImplementedParamType |
||
| 47 | */ |
||
| 48 | 11 | public function validate($value, ElementInterface $element): FormError |
|
| 55 | } |
||
| 56 | } |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * {@inheritdoc} |
||
| 61 | */ |
||
| 62 | public function constraints(): array |
||
| 67 |