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