@@ -15,8 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | public function __construct() |
17 | 17 | { |
18 | - parent::__construct |
|
19 | - ( |
|
18 | + parent::__construct( |
|
20 | 19 | 'You can not append a string of a different encoding '. |
21 | 20 | 'to that of the existing string!' |
22 | 21 | ); |
@@ -232,16 +232,14 @@ |
||
232 | 232 | */ |
233 | 233 | public function remove($startIndex, $length) |
234 | 234 | { |
235 | - $start = UTF8::substr |
|
236 | - ( |
|
235 | + $start = UTF8::substr( |
|
237 | 236 | (string)$this->str, |
238 | 237 | 0, |
239 | 238 | $startIndex, |
240 | 239 | $this->str->getEncoding() |
241 | 240 | ); |
242 | 241 | |
243 | - $end = UTF8::substr |
|
244 | - ( |
|
242 | + $end = UTF8::substr( |
|
245 | 243 | (string)$this->str, |
246 | 244 | $startIndex + $length, |
247 | 245 | $this->str->getLength(), |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function startsWith($substring, $caseSensitive = true) |
31 | 31 | { |
32 | - $startOfStr = UTF8::substr |
|
33 | - ( |
|
32 | + $startOfStr = UTF8::substr( |
|
34 | 33 | $this->scalarString, |
35 | 34 | 0, |
36 | 35 | UTF8::strlen($substring, $this->encoding), |
@@ -60,8 +59,7 @@ discard block |
||
60 | 59 | { |
61 | 60 | $substringLength = UTF8::strlen($substring, $this->encoding); |
62 | 61 | |
63 | - $endOfStr = UTF8::substr |
|
64 | - ( |
|
62 | + $endOfStr = UTF8::substr( |
|
65 | 63 | $this->scalarString, |
66 | 64 | $this->getLength() - $substringLength, |
67 | 65 | $substringLength, |
@@ -66,16 +66,14 @@ discard block |
||
66 | 66 | { |
67 | 67 | if ($index > $this->getLength()) throw new \OutOfBoundsException(); |
68 | 68 | |
69 | - $start = UTF8::substr |
|
70 | - ( |
|
69 | + $start = UTF8::substr( |
|
71 | 70 | $this->scalarString, |
72 | 71 | 0, |
73 | 72 | $index, |
74 | 73 | $this->encoding |
75 | 74 | ); |
76 | 75 | |
77 | - $end = UTF8::substr |
|
78 | - ( |
|
76 | + $end = UTF8::substr( |
|
79 | 77 | $this->scalarString, |
80 | 78 | $index, |
81 | 79 | $this->getLength(), |
@@ -104,8 +102,7 @@ discard block |
||
104 | 102 | */ |
105 | 103 | public function repeat($multiplier) |
106 | 104 | { |
107 | - return $this->newSelf |
|
108 | - ( |
|
105 | + return $this->newSelf( |
|
109 | 106 | UTF8::str_repeat($this->scalarString, $multiplier) |
110 | 107 | ); |
111 | 108 | } |
@@ -163,8 +160,7 @@ discard block |
||
163 | 160 | $length = $end - $start; |
164 | 161 | } |
165 | 162 | |
166 | - return $this->newSelf |
|
167 | - ( |
|
163 | + return $this->newSelf( |
|
168 | 164 | UTF8::substr($this->scalarString, $start, $length, $this->encoding) |
169 | 165 | ); |
170 | 166 | } |
@@ -179,8 +175,7 @@ discard block |
||
179 | 175 | */ |
180 | 176 | public function surround($substring) |
181 | 177 | { |
182 | - return $this->newSelf |
|
183 | - ( |
|
178 | + return $this->newSelf( |
|
184 | 179 | implode('', [$substring, $this->scalarString, $substring]) |
185 | 180 | ); |
186 | 181 | } |
@@ -213,8 +208,7 @@ discard block |
||
213 | 208 | { |
214 | 209 | if ($caseSensitive) |
215 | 210 | { |
216 | - return UTF8::substr_count |
|
217 | - ( |
|
211 | + return UTF8::substr_count( |
|
218 | 212 | $this->scalarString, |
219 | 213 | $substring, |
220 | 214 | $this->encoding |
@@ -42,8 +42,7 @@ |
||
42 | 42 | $endIndex = $this->indexOf($end, $substrIndex); |
43 | 43 | if ($endIndex === false) return $this->newSelf(''); |
44 | 44 | |
45 | - $result = UTF8::substr |
|
46 | - ( |
|
45 | + $result = UTF8::substr( |
|
47 | 46 | $this->scalarString, |
48 | 47 | $substrIndex, |
49 | 48 | $endIndex - $substrIndex, |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | if ($n > 0) |
30 | 30 | { |
31 | - $first = UTF8::substr |
|
32 | - ( |
|
31 | + $first = UTF8::substr( |
|
33 | 32 | $this->scalarString, |
34 | 33 | 0, |
35 | 34 | $n, |
@@ -53,8 +52,7 @@ discard block |
||
53 | 52 | |
54 | 53 | if ($n > 0) |
55 | 54 | { |
56 | - $last = UTF8::substr |
|
57 | - ( |
|
55 | + $last = UTF8::substr( |
|
58 | 56 | $this->scalarString, |
59 | 57 | -$n, |
60 | 58 | null, |
@@ -26,10 +26,8 @@ discard block |
||
26 | 26 | { |
27 | 27 | if ($this->startsWith($substring)) |
28 | 28 | { |
29 | - return $this->newSelf |
|
30 | - ( |
|
31 | - UTF8::substr |
|
32 | - ( |
|
29 | + return $this->newSelf( |
|
30 | + UTF8::substr( |
|
33 | 31 | $this->scalarString, |
34 | 32 | UTF8::strlen($substring, $this->encoding), |
35 | 33 | null, |
@@ -52,10 +50,8 @@ discard block |
||
52 | 50 | { |
53 | 51 | if ($this->endsWith($substring)) |
54 | 52 | { |
55 | - return $this->newSelf |
|
56 | - ( |
|
57 | - UTF8::substr |
|
58 | - ( |
|
53 | + return $this->newSelf( |
|
54 | + UTF8::substr( |
|
59 | 55 | $this->scalarString, |
60 | 56 | 0, |
61 | 57 | $this->getLength() - UTF8::strlen($substring, $this->encoding), |
@@ -36,15 +36,14 @@ discard block |
||
36 | 36 | $substringLength = UTF8::strlen($substring, $this->encoding); |
37 | 37 | $length -= $substringLength; |
38 | 38 | |
39 | - $truncated = UTF8::substr |
|
40 | - ( |
|
39 | + $truncated = UTF8::substr( |
|
41 | 40 | $this->scalarString, |
42 | 41 | 0, |
43 | 42 | $length, |
44 | 43 | $this->encoding |
45 | 44 | ); |
46 | 45 | |
47 | - return $this->newSelf($truncated . $substring); |
|
46 | + return $this->newSelf($truncated.$substring); |
|
48 | 47 | } |
49 | 48 | |
50 | 49 | /** |
@@ -79,6 +78,6 @@ discard block |
||
79 | 78 | $truncated = UTF8::substr($truncated, 0, $lastPos, $this->encoding); |
80 | 79 | } |
81 | 80 | |
82 | - return $this->newSelf($truncated . $substring); |
|
81 | + return $this->newSelf($truncated.$substring); |
|
83 | 82 | } |
84 | 83 | } |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | if (!in_array($padType, ['left', 'right', 'both'], true)) |
39 | 39 | { |
40 | - throw new \InvalidArgumentException |
|
41 | - ( |
|
40 | + throw new \InvalidArgumentException( |
|
42 | 41 | 'Pad expects $padType '."to be one of 'left', 'right' or 'both'" |
43 | 42 | ); |
44 | 43 | } |
@@ -118,16 +117,14 @@ discard block |
||
118 | 117 | |
119 | 118 | if (!$length || $paddedLength <= $strLength) return $this; |
120 | 119 | |
121 | - $leftPadding = UTF8::substr |
|
122 | - ( |
|
120 | + $leftPadding = UTF8::substr( |
|
123 | 121 | UTF8::str_repeat($padStr, ceil($left / $length)), |
124 | 122 | 0, |
125 | 123 | $left, |
126 | 124 | $this->encoding |
127 | 125 | ); |
128 | 126 | |
129 | - $rightPadding = UTF8::substr |
|
130 | - ( |
|
127 | + $rightPadding = UTF8::substr( |
|
131 | 128 | UTF8::str_repeat($padStr, ceil($right / $length)), |
132 | 129 | 0, |
133 | 130 | $right, |