1 | <?php |
||
9 | final class StringEnsurance implements EnsuranceInterface |
||
10 | { |
||
11 | use EnsuranceTrait; |
||
12 | |||
13 | /** |
||
14 | * StringEnsurance constructor. |
||
15 | * |
||
16 | * @param EnsuranceInterface $ensurance |
||
17 | */ |
||
18 | public function __construct(EnsuranceInterface $ensurance) |
||
22 | |||
23 | 12 | /** |
|
24 | * @param string $str |
||
25 | 12 | * |
|
26 | 12 | * @return StringEnsurance |
|
27 | */ |
||
28 | public function isEqualTo(string $str): self |
||
34 | |||
35 | 1 | /** |
|
36 | * @param string $str |
||
37 | 1 | * |
|
38 | * @return StringEnsurance |
||
39 | */ |
||
40 | public function isNotEqualTo(string $str): self |
||
46 | |||
47 | 1 | /** |
|
48 | * @param string $pattern |
||
49 | 1 | * |
|
50 | * @return StringEnsurance |
||
51 | */ |
||
52 | public function matches(string $pattern): self |
||
58 | |||
59 | 1 | /** |
|
60 | * @param int $length |
||
61 | 1 | * |
|
62 | * @return StringEnsurance |
||
63 | */ |
||
64 | public function hasLengthOf(int $length): self |
||
71 | 1 | ||
72 | 1 | /** |
|
73 | * @param int $length |
||
74 | 1 | * |
|
75 | * @return StringEnsurance |
||
76 | */ |
||
77 | public function isShorterThan(int $length): self |
||
84 | 1 | ||
85 | 1 | /** |
|
86 | * @param int $length |
||
87 | 1 | * |
|
88 | * @return StringEnsurance |
||
89 | */ |
||
90 | public function isShorterOrEqualTo(int $length): self |
||
97 | 1 | ||
98 | 1 | /** |
|
99 | * @param int $length |
||
100 | 1 | * |
|
101 | * @return StringEnsurance |
||
102 | */ |
||
103 | public function isLongerThan(int $length): self |
||
110 | 1 | ||
111 | 1 | /** |
|
112 | * @param int $length |
||
113 | 1 | * |
|
114 | * @return StringEnsurance |
||
115 | */ |
||
116 | public function isLongerOrEqualTo(int $length): self |
||
123 | 1 | ||
124 | 1 | /** |
|
125 | * @param string $str |
||
126 | 1 | * |
|
127 | * @return StringEnsurance |
||
128 | */ |
||
129 | public function beginsWith(string $str): self |
||
136 | 1 | ||
137 | 1 | /** |
|
138 | * @param string $str |
||
139 | 1 | * |
|
140 | * @return StringEnsurance |
||
141 | */ |
||
142 | public function endsWith(string $str): self |
||
149 | 1 | ||
150 | 1 | /** |
|
151 | * @return StringEnsurance |
||
152 | 1 | */ |
|
153 | public function isCallable(): self |
||
159 | |||
160 | 1 | /** |
|
161 | 1 | * @return ReflectionEnsurance |
|
162 | * @throws \ReflectionException |
||
163 | */ |
||
164 | public function isClass(): ReflectionEnsurance |
||
170 | 1 | ||
171 | /** |
||
172 | * @return StringEnsurance |
||
173 | */ |
||
174 | public function isJson(): self |
||
182 | |||
183 | /** |
||
184 | * @return StringEnsurance |
||
185 | */ |
||
186 | public function isXml(): self |
||
199 | } |
||
200 |