@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * The converted string will be all lowercase. |
61 | 61 | * @return Transliteration |
62 | 62 | */ |
63 | - public function setLowercase(bool $lowercase=true) : Transliteration |
|
63 | + public function setLowercase(bool $lowercase = true) : Transliteration |
|
64 | 64 | { |
65 | 65 | $this->setOption('lowercase', $lowercase); |
66 | 66 | |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | |
98 | 98 | $result = implode('', $keep); |
99 | 99 | |
100 | - while (strstr($result, $space . $space)) { |
|
101 | - $result = str_replace($space . $space, $space, $result); |
|
100 | + while (strstr($result, $space.$space)) { |
|
101 | + $result = str_replace($space.$space, $space, $result); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | $result = trim($result, $space); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $this->bytes = $bytes; |
34 | 34 | |
35 | 35 | // correct negative values |
36 | - if($this->bytes < 0) |
|
36 | + if ($this->bytes < 0) |
|
37 | 37 | { |
38 | 38 | $this->bytes = 0; |
39 | 39 | } |
@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | { |
50 | 50 | $sizes = $this->getSizesSorted($base); |
51 | 51 | |
52 | - if($this->bytes >= $sizes[0]->getBytes()) |
|
52 | + if ($this->bytes >= $sizes[0]->getBytes()) |
|
53 | 53 | { |
54 | 54 | $total = count($sizes); |
55 | 55 | |
56 | - for($i=0; $i < $total; $i++) |
|
56 | + for ($i = 0; $i < $total; $i++) |
|
57 | 57 | { |
58 | 58 | $size = $sizes[$i]; |
59 | 59 | |
60 | - if(!isset($sizes[($i+1)])) { |
|
60 | + if (!isset($sizes[($i + 1)])) { |
|
61 | 61 | return $size; |
62 | 62 | } |
63 | 63 | |
64 | - if($this->bytes >= $size->getBytes() && $this->bytes < $sizes[($i+1)]->getBytes()) { |
|
64 | + if ($this->bytes >= $size->getBytes() && $this->bytes < $sizes[($i + 1)]->getBytes()) { |
|
65 | 65 | return $size; |
66 | 66 | } |
67 | 67 | } |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | * @see ConvertHelper_StorageSizeEnum::BASE_10 |
100 | 100 | * @see ConvertHelper_StorageSizeEnum::BASE_2 |
101 | 101 | */ |
102 | - public function toString(int $precision, int $base=ConvertHelper_StorageSizeEnum::BASE_10) : string |
|
102 | + public function toString(int $precision, int $base = ConvertHelper_StorageSizeEnum::BASE_10) : string |
|
103 | 103 | { |
104 | 104 | $size = $this->detectSize($base); |
105 | 105 | |
106 | - return round($this->bytes / $size->getBytes(), $precision) . ' ' . $size->getSuffix(); |
|
106 | + return round($this->bytes / $size->getBytes(), $precision).' '.$size->getSuffix(); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param int $precision Amount of decimals (rounded up) |
127 | 127 | * @return float |
128 | 128 | */ |
129 | - public function toKilobytes(int $precision=1) : float |
|
129 | + public function toKilobytes(int $precision = 1) : float |
|
130 | 130 | { |
131 | 131 | return $this->toNumber($precision, 'kb'); |
132 | 132 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param int $precision Amount of decimals (rounded up) |
138 | 138 | * @return float |
139 | 139 | */ |
140 | - public function toMegabytes(int $precision=1) : float |
|
140 | + public function toMegabytes(int $precision = 1) : float |
|
141 | 141 | { |
142 | 142 | return $this->toNumber($precision, 'mb'); |
143 | 143 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param int $precision Amount of decimals (rounded up) |
149 | 149 | * @return float |
150 | 150 | */ |
151 | - public function toGigabytes(int $precision=1) : float |
|
151 | + public function toGigabytes(int $precision = 1) : float |
|
152 | 152 | { |
153 | 153 | return $this->toNumber($precision, 'gb'); |
154 | 154 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * @param int $precision Amount of decimals (rounded up) |
160 | 160 | * @return float |
161 | 161 | */ |
162 | - public function toTerabytes(int $precision=1) : float |
|
162 | + public function toTerabytes(int $precision = 1) : float |
|
163 | 163 | { |
164 | 164 | return $this->toNumber($precision, 'tb'); |
165 | 165 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param int $precision Amount of decimals (rounded up) |
171 | 171 | * @return float |
172 | 172 | */ |
173 | - public function toPetabytes(int $precision=1) : float |
|
173 | + public function toPetabytes(int $precision = 1) : float |
|
174 | 174 | { |
175 | 175 | return $this->toNumber($precision, 'pb'); |
176 | 176 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @param int $precision Amount of decimals (rounded up) |
182 | 182 | * @return float |
183 | 183 | */ |
184 | - public function toKibibytes(int $precision=1) : float |
|
184 | + public function toKibibytes(int $precision = 1) : float |
|
185 | 185 | { |
186 | 186 | return $this->toNumber($precision, 'kib'); |
187 | 187 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @param int $precision Amount of decimals (rounded up) |
193 | 193 | * @return float |
194 | 194 | */ |
195 | - public function toMebibytes(int $precision=1) : float |
|
195 | + public function toMebibytes(int $precision = 1) : float |
|
196 | 196 | { |
197 | 197 | return $this->toNumber($precision, 'mib'); |
198 | 198 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @param int $precision Amount of decimals (rounded up) |
204 | 204 | * @return float |
205 | 205 | */ |
206 | - public function toGibibytes(int $precision=1) : float |
|
206 | + public function toGibibytes(int $precision = 1) : float |
|
207 | 207 | { |
208 | 208 | return $this->toNumber($precision, 'gib'); |
209 | 209 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @param int $precision Amount of decimals (rounded up) |
215 | 215 | * @return float |
216 | 216 | */ |
217 | - public function toTebibytes(int $precision=1) : float |
|
217 | + public function toTebibytes(int $precision = 1) : float |
|
218 | 218 | { |
219 | 219 | return $this->toNumber($precision, 'tib'); |
220 | 220 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @param int $precision Amount of decimals (rounded up) |
226 | 226 | * @return float |
227 | 227 | */ |
228 | - public function toPebibytes(int $precision=1) : float |
|
228 | + public function toPebibytes(int $precision = 1) : float |
|
229 | 229 | { |
230 | 230 | return $this->toNumber($precision, 'pib'); |
231 | 231 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return string |
100 | 100 | * @see ConvertHelper::bytes2readable() |
101 | 101 | */ |
102 | - public function toString(int $precision=1) : string |
|
102 | + public function toString(int $precision = 1) : string |
|
103 | 103 | { |
104 | 104 | return ConvertHelper::bytes2readable($this->bytes, $precision, $this->getBase()); |
105 | 105 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function getBase() : int |
112 | 112 | { |
113 | - if($this->isValid()) { |
|
113 | + if ($this->isValid()) { |
|
114 | 114 | return $this->sizeDefinition->getBase(); |
115 | 115 | } |
116 | 116 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function getSizeDefinition() : ?ConvertHelper_StorageSizeEnum_Size |
128 | 128 | { |
129 | - if($this->isValid()) { |
|
129 | + if ($this->isValid()) { |
|
130 | 130 | return $this->sizeDefinition; |
131 | 131 | } |
132 | 132 | |
@@ -175,18 +175,18 @@ discard block |
||
175 | 175 | |
176 | 176 | protected function parseSize() : void |
177 | 177 | { |
178 | - if(!$this->detectParts()) { |
|
178 | + if (!$this->detectParts()) { |
|
179 | 179 | return; |
180 | 180 | } |
181 | 181 | |
182 | 182 | // we detected units in the string: all good. |
183 | - if($this->units !== null) |
|
183 | + if ($this->units !== null) |
|
184 | 184 | { |
185 | 185 | return; |
186 | 186 | } |
187 | 187 | |
188 | 188 | // just a numeric value: we assume this means we're dealing with bytes. |
189 | - if(is_numeric($this->number)) |
|
189 | + if (is_numeric($this->number)) |
|
190 | 190 | { |
191 | 191 | $this->units = 'b'; |
192 | 192 | return; |
@@ -212,12 +212,12 @@ discard block |
||
212 | 212 | |
213 | 213 | $number = $this->sizeString; |
214 | 214 | |
215 | - foreach($units as $unit) |
|
215 | + foreach ($units as $unit) |
|
216 | 216 | { |
217 | - if(stristr($number, $unit)) |
|
217 | + if (stristr($number, $unit)) |
|
218 | 218 | { |
219 | 219 | // there are more than 1 unit defined in the string |
220 | - if($this->units !== null) |
|
220 | + if ($this->units !== null) |
|
221 | 221 | { |
222 | 222 | $this->setError( |
223 | 223 | t( |
@@ -273,14 +273,14 @@ discard block |
||
273 | 273 | { |
274 | 274 | $this->parseSize(); |
275 | 275 | |
276 | - if(!$this->valid) { |
|
276 | + if (!$this->valid) { |
|
277 | 277 | return; |
278 | 278 | } |
279 | 279 | |
280 | 280 | $int = intval($this->number); |
281 | 281 | |
282 | 282 | // negative values |
283 | - if($int < 0) |
|
283 | + if ($int < 0) |
|
284 | 284 | { |
285 | 285 | $this->setError( |
286 | 286 | t('Negative values cannot be used as size.'), |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | $result = array(); |
48 | 48 | |
49 | - foreach($this->headers as $header) |
|
49 | + foreach ($this->headers as $header) |
|
50 | 50 | { |
51 | 51 | $result[] = $header['type']; |
52 | 52 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | { |
62 | 62 | // we may be in a CLI environment where the headers |
63 | 63 | // are not populated. |
64 | - if(!isset($_SERVER['HTTP_ACCEPT'])) { |
|
64 | + if (!isset($_SERVER['HTTP_ACCEPT'])) { |
|
65 | 65 | return; |
66 | 66 | } |
67 | 67 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | $accept = array(); |
81 | 81 | |
82 | - foreach($tokens as $i => $term) |
|
82 | + foreach ($tokens as $i => $term) |
|
83 | 83 | { |
84 | 84 | $accept[] = $this->parseEntry($i, $term); |
85 | 85 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | 'type' => null |
106 | 106 | ); |
107 | 107 | |
108 | - if(strstr($mime, ';')) |
|
108 | + if (strstr($mime, ';')) |
|
109 | 109 | { |
110 | 110 | $parts = explode(';', $mime); |
111 | 111 | $mime = array_shift($parts); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | // like an URL query string if separated by ampersands; |
115 | 115 | $entry['params'] = ConvertHelper::parseQueryString(implode('&', $parts)); |
116 | 116 | |
117 | - if(isset($entry['params']['q'])) |
|
117 | + if (isset($entry['params']['q'])) |
|
118 | 118 | { |
119 | 119 | $entry['quality'] = (double)$entry['params']['q']; |
120 | 120 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | protected function _filter() |
22 | 22 | { |
23 | - if($this->value === 'yes' || $this->value === 'true' || $this->value === true) { |
|
23 | + if ($this->value === 'yes' || $this->value === 'true' || $this->value === true) { |
|
24 | 24 | return true; |
25 | 25 | } |
26 | 26 |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | |
24 | 24 | protected function _filter() |
25 | 25 | { |
26 | - if(is_array($this->value)) { |
|
26 | + if (is_array($this->value)) { |
|
27 | 27 | return $this->value; |
28 | 28 | } |
29 | 29 | |
30 | - if($this->value === '' || $this->value === null || !is_string($this->value)) { |
|
30 | + if ($this->value === '' || $this->value === null || !is_string($this->value)) { |
|
31 | 31 | return array(); |
32 | 32 | } |
33 | 33 | |
@@ -35,19 +35,19 @@ discard block |
||
35 | 35 | $stripEmptyEntries = $this->getBoolOption('stripEmptyEntries'); |
36 | 36 | $result = explode(',', $this->value); |
37 | 37 | |
38 | - if(!$trimEntries && !$stripEmptyEntries) { |
|
38 | + if (!$trimEntries && !$stripEmptyEntries) { |
|
39 | 39 | return $result; |
40 | 40 | } |
41 | 41 | |
42 | 42 | $keep = array(); |
43 | 43 | |
44 | - foreach($result as $entry) |
|
44 | + foreach ($result as $entry) |
|
45 | 45 | { |
46 | - if($trimEntries === true) { |
|
46 | + if ($trimEntries === true) { |
|
47 | 47 | $entry = trim($entry); |
48 | 48 | } |
49 | 49 | |
50 | - if($stripEmptyEntries === true && $entry === '') { |
|
50 | + if ($stripEmptyEntries === true && $entry === '') { |
|
51 | 51 | continue; |
52 | 52 | } |
53 | 53 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | protected function _filter() |
22 | 22 | { |
23 | - if(!is_scalar($this->value)) { |
|
23 | + if (!is_scalar($this->value)) { |
|
24 | 24 | return ''; |
25 | 25 | } |
26 | 26 |
@@ -27,11 +27,11 @@ |
||
27 | 27 | |
28 | 28 | protected function _validate() |
29 | 29 | { |
30 | - if(!is_scalar($this->value)) { |
|
30 | + if (!is_scalar($this->value)) { |
|
31 | 31 | return null; |
32 | 32 | } |
33 | 33 | |
34 | - if(preg_match('/\A[a-zA-Z]+\z/', $this->value)) { |
|
34 | + if (preg_match('/\A[a-zA-Z]+\z/', $this->value)) { |
|
35 | 35 | return $this->value; |
36 | 36 | } |
37 | 37 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | array_unshift($args, $this->value); |
35 | 35 | |
36 | 36 | $result = call_user_func_array($this->getOption('callback'), $args); |
37 | - if($result !== false) { |
|
37 | + if ($result !== false) { |
|
38 | 38 | return $this->value; |
39 | 39 | } |
40 | 40 |