‪TYPO3CMS  9.5
Validate.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 
5 
6 /*
7  * This file is part of the TYPO3 CMS project.
8  *
9  * It is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License, either version 2
11  * of the License, or any later version.
12  *
13  * For the full copyright and license information, please read the
14  * LICENSE.txt file that was distributed with this source code.
15  *
16  * The TYPO3 project - inspiring people to share!
17  */
18 
19 use Doctrine\Common\Annotations\Annotation\Required;
20 
26 {
31  public ‪$validator = '';
32 
36  public ‪$param = '';
37 
41  public ‪$options = [];
42 
46  public function ‪__construct(array $values)
47  {
48  if (isset($values['value'])) {
49  $this->validator = $values['value'];
50  }
51 
52  if (isset($values['validator'])) {
53  $this->validator = $values['validator'];
54  }
55 
56  if (isset($values['options'])) {
57  $this->options = $values['options'];
58  }
59 
60  if (isset($values['param'])) {
61  $this->param = $values['param'];
62  }
63  }
64 
68  public function ‪__toString()
69  {
70  $strings = [];
71 
72  if ($this->param !== '') {
73  $strings[] = ‪$this->param;
74  }
75 
76  $strings[] = ‪$this->validator;
77 
78  if (count($this->options) > 0) {
79  $validatorOptionsStrings = [];
80  foreach ($this->options as $optionKey => $optionValue) {
81  $validatorOptionsStrings[] = $optionKey . '=' . $optionValue;
82  }
83 
84  $strings[] = '(' . implode(', ', $validatorOptionsStrings) . ')';
85  }
86 
87  return trim(implode(' ', $strings));
88  }
89 }
‪TYPO3\CMS\Extbase\Annotation\Validate\$param
‪string $param
Definition: Validate.php:34
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:4
‪TYPO3\CMS\Extbase\Annotation\Validate\__toString
‪string __toString()
Definition: Validate.php:65
‪TYPO3\CMS\Extbase\Annotation\Validate\__construct
‪__construct(array $values)
Definition: Validate.php:43
‪TYPO3\CMS\Extbase\Annotation\Validate\$options
‪array $options
Definition: Validate.php:38
‪TYPO3\CMS\Extbase\Annotation\Validate\$validator
‪string $validator
Definition: Validate.php:30
‪TYPO3\CMS\Extbase\Annotation\Validate
Definition: Validate.php:26