‪TYPO3CMS  10.4
MethodParameter.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 
25 {
29  private ‪$name;
30 
34  private ‪$definition;
35 
40  public function ‪__construct(string ‪$name, array ‪$definition)
41  {
42  $this->name = ‪$name;
43 
44  $defaults = [
45  'type' => null,
46  'array' => false,
47  'optional' => false,
48  'hasDefaultValue' => false,
49  'defaultValue' => null,
50  'dependency' => null,
51  'ignoreValidation' => false,
52  'validators' => [],
53  'position' => -1,
54  ];
55 
56  foreach ($defaults as $key => $defaultValue) {
57  if (!isset(‪$definition[$key])) {
58  ‪$definition[$key] = $defaultValue;
59  }
60  }
61 
62  $this->definition = ‪$definition;
63  }
64 
68  public function ‪getName(): string
69  {
70  return ‪$this->name;
71  }
72 
76  public function ‪getType(): ?string
77  {
78  return $this->definition['type'];
79  }
80 
84  public function ‪isArray(): bool
85  {
86  return $this->definition['array'];
87  }
88 
92  public function ‪hasDefaultValue(): bool
93  {
94  return $this->definition['hasDefaultValue'];
95  }
96 
100  public function ‪getDefaultValue()
101  {
102  return $this->definition['defaultValue'];
103  }
104 
108  public function ‪getValidators(): array
109  {
110  return $this->definition['validators'];
111  }
112 
116  public function ‪ignoreValidation(): bool
117  {
118  return $this->definition['ignoreValidation'];
119  }
120 
124  public function ‪isOptional(): bool
125  {
126  return $this->definition['optional'];
127  }
128 
132  public function ‪getDependency(): ?string
133  {
134  return $this->definition['dependency'];
135  }
136 
140  public function ‪getPosition(): int
141  {
142  return $this->definition['position'];
143  }
144 }
‪TYPO3\CMS\Extbase\Reflection\ClassSchema\MethodParameter\getType
‪string null getType()
Definition: MethodParameter.php:74
‪TYPO3\CMS\Extbase\Reflection\ClassSchema\MethodParameter\getDependency
‪string null getDependency()
Definition: MethodParameter.php:130
‪TYPO3\CMS\Extbase\Reflection\ClassSchema\MethodParameter\$name
‪string $name
Definition: MethodParameter.php:28
‪TYPO3\CMS\Extbase\Reflection\ClassSchema\MethodParameter\$definition
‪array $definition
Definition: MethodParameter.php:32
‪TYPO3\CMS\Extbase\Reflection\ClassSchema\MethodParameter\getValidators
‪array getValidators()
Definition: MethodParameter.php:106
‪TYPO3\CMS\Extbase\Reflection\ClassSchema\MethodParameter\isArray
‪bool isArray()
Definition: MethodParameter.php:82
‪TYPO3\CMS\Extbase\Reflection\ClassSchema\MethodParameter\isOptional
‪bool isOptional()
Definition: MethodParameter.php:122
‪TYPO3\CMS\Extbase\Reflection\ClassSchema\MethodParameter
Definition: MethodParameter.php:25
‪TYPO3\CMS\Extbase\Reflection\ClassSchema
‪TYPO3\CMS\Extbase\Reflection\ClassSchema\MethodParameter\getName
‪string getName()
Definition: MethodParameter.php:66
‪TYPO3\CMS\Extbase\Reflection\ClassSchema\MethodParameter\hasDefaultValue
‪bool hasDefaultValue()
Definition: MethodParameter.php:90
‪TYPO3\CMS\Extbase\Reflection\ClassSchema\MethodParameter\getDefaultValue
‪mixed getDefaultValue()
Definition: MethodParameter.php:98
‪TYPO3\CMS\Extbase\Reflection\ClassSchema\MethodParameter\ignoreValidation
‪bool ignoreValidation()
Definition: MethodParameter.php:114
‪TYPO3\CMS\Extbase\Reflection\ClassSchema\MethodParameter\getPosition
‪int getPosition()
Definition: MethodParameter.php:138
‪TYPO3\CMS\Extbase\Reflection\ClassSchema\MethodParameter\__construct
‪__construct(string $name, array $definition)
Definition: MethodParameter.php:38