1 | <?php |
||
14 | class StringType extends AbstractDataType |
||
15 | { |
||
16 | /** |
||
17 | * @var int |
||
18 | */ |
||
19 | protected $minLength; |
||
20 | |||
21 | /** |
||
22 | * @var int |
||
23 | */ |
||
24 | protected $maxLength; |
||
25 | |||
26 | /** |
||
27 | * @var array|null |
||
28 | */ |
||
29 | protected $allowedValues = null; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $regex; |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $regexGroup; |
||
40 | |||
41 | /** |
||
42 | * @return int|null |
||
43 | */ |
||
44 | 57 | public function getMinLength(): ?int |
|
48 | |||
49 | /** |
||
50 | * @param int $minLength |
||
51 | * |
||
52 | * @return \Wszetko\Sitemap\Items\DataTypes\StringType |
||
53 | */ |
||
54 | 24 | public function setMinLength(int $minLength): self |
|
60 | |||
61 | /** |
||
62 | * @return int|null |
||
63 | */ |
||
64 | 57 | public function getMaxLength(): ?int |
|
68 | |||
69 | /** |
||
70 | * @param int $maxLength |
||
71 | * |
||
72 | * @return self |
||
73 | */ |
||
74 | 24 | public function setMaxLength(int $maxLength): self |
|
80 | |||
81 | /** |
||
82 | * @return array|null |
||
83 | */ |
||
84 | 57 | public function getAllowedValues(): ?array |
|
88 | |||
89 | /** |
||
90 | * @param string|array|null $allowedValues |
||
91 | * |
||
92 | * @return \Wszetko\Sitemap\Items\DataTypes\StringType |
||
93 | */ |
||
94 | 43 | public function setAllowedValues($allowedValues): self |
|
108 | |||
109 | /** |
||
110 | * @param string $regex |
||
111 | * @param string $regexGroup |
||
112 | * |
||
113 | * @return \Wszetko\Sitemap\Items\DataTypes\StringType |
||
114 | */ |
||
115 | 40 | public function setValueRegex(string $regex, string $regexGroup): self |
|
122 | |||
123 | /** |
||
124 | * @return array|null |
||
125 | */ |
||
126 | 57 | public function getValueRegex(): ?array |
|
135 | |||
136 | /** |
||
137 | * @param string|int|float|object|null $value |
||
138 | * @param array $parameters |
||
139 | * |
||
140 | * @return self |
||
141 | */ |
||
142 | 57 | public function setValue($value, ...$parameters): DataType |
|
193 | } |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: