@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param int $code |
37 | 37 | * @return $this |
38 | 38 | */ |
39 | - public function makeError(string $message, int $code=0) : OperationResult |
|
39 | + public function makeError(string $message, int $code = 0) : OperationResult |
|
40 | 40 | { |
41 | 41 | return $this->add('makeError', $message, $code); |
42 | 42 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param int $code |
47 | 47 | * @return $this |
48 | 48 | */ |
49 | - public function makeSuccess(string $message, int $code=0) : OperationResult |
|
49 | + public function makeSuccess(string $message, int $code = 0) : OperationResult |
|
50 | 50 | { |
51 | 51 | return $this->add('makeSuccess', $message, $code); |
52 | 52 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param int $code |
57 | 57 | * @return $this |
58 | 58 | */ |
59 | - public function makeWarning(string $message, int $code=0) : OperationResult |
|
59 | + public function makeWarning(string $message, int $code = 0) : OperationResult |
|
60 | 60 | { |
61 | 61 | return $this->add('makeWarning', $message, $code); |
62 | 62 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @param int $code |
67 | 67 | * @return $this |
68 | 68 | */ |
69 | - public function makeNotice(string $message, int $code=0) : OperationResult |
|
69 | + public function makeNotice(string $message, int $code = 0) : OperationResult |
|
70 | 70 | { |
71 | 71 | return $this->add('makeNotice', $message, $code); |
72 | 72 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @param int $code |
78 | 78 | * @return $this |
79 | 79 | */ |
80 | - protected function add(string $method, string $message, int $code=0) : OperationResult |
|
80 | + protected function add(string $method, string $message, int $code = 0) : OperationResult |
|
81 | 81 | { |
82 | 82 | $result = new OperationResult($this->subject); |
83 | 83 | $result->$method($message, $code); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function addResult(OperationResult $result) : OperationResult_Collection |
97 | 97 | { |
98 | - if($result instanceof OperationResult_Collection) |
|
98 | + if ($result instanceof OperationResult_Collection) |
|
99 | 99 | { |
100 | 100 | return $this->importCollection($result); |
101 | 101 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | $results = $collection->getResults(); |
117 | 117 | |
118 | - foreach($results as $result) |
|
118 | + foreach ($results as $result) |
|
119 | 119 | { |
120 | 120 | $this->addResult($result); |
121 | 121 | } |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | |
134 | 134 | public function isValid() : bool |
135 | 135 | { |
136 | - foreach($this->results as $result) |
|
136 | + foreach ($this->results as $result) |
|
137 | 137 | { |
138 | - if(!$result->isValid()) |
|
138 | + if (!$result->isValid()) |
|
139 | 139 | { |
140 | 140 | return false; |
141 | 141 | } |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | |
147 | 147 | public function hasCode() : bool |
148 | 148 | { |
149 | - foreach($this->results as $result) |
|
149 | + foreach ($this->results as $result) |
|
150 | 150 | { |
151 | - if($result->hasCode()) |
|
151 | + if ($result->hasCode()) |
|
152 | 152 | { |
153 | 153 | return true; |
154 | 154 | } |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | |
160 | 160 | public function getCode() : int |
161 | 161 | { |
162 | - foreach($this->results as $result) |
|
162 | + foreach ($this->results as $result) |
|
163 | 163 | { |
164 | - if($result->hasCode()) |
|
164 | + if ($result->hasCode()) |
|
165 | 165 | { |
166 | 166 | return $result->getCode(); |
167 | 167 | } |
@@ -170,13 +170,13 @@ discard block |
||
170 | 170 | return 0; |
171 | 171 | } |
172 | 172 | |
173 | - public function getMessage(string $type='') : string |
|
173 | + public function getMessage(string $type = '') : string |
|
174 | 174 | { |
175 | - foreach($this->results as $result) |
|
175 | + foreach ($this->results as $result) |
|
176 | 176 | { |
177 | 177 | $msg = $result->getMessage($type); |
178 | 178 | |
179 | - if(!empty($msg)) |
|
179 | + if (!empty($msg)) |
|
180 | 180 | { |
181 | 181 | return $msg; |
182 | 182 | } |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | |
188 | 188 | public function containsCode(int $code) : bool |
189 | 189 | { |
190 | - foreach($this->results as $result) |
|
190 | + foreach ($this->results as $result) |
|
191 | 191 | { |
192 | - if($result->getCode() === $code) |
|
192 | + if ($result->getCode() === $code) |
|
193 | 193 | { |
194 | 194 | return true; |
195 | 195 | } |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | { |
223 | 223 | $amount = 0; |
224 | 224 | |
225 | - foreach($this->results as $result) |
|
225 | + foreach ($this->results as $result) |
|
226 | 226 | { |
227 | - if($result->isType($type)) |
|
227 | + if ($result->isType($type)) |
|
228 | 228 | { |
229 | 229 | $amount++; |
230 | 230 | } |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | { |
263 | 263 | $results = array(); |
264 | 264 | |
265 | - foreach($this->results as $result) |
|
265 | + foreach ($this->results as $result) |
|
266 | 266 | { |
267 | - if($result->isType($type)) |
|
267 | + if ($result->isType($type)) |
|
268 | 268 | { |
269 | 269 | $results[] = $result; |
270 | 270 | } |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | |
276 | 276 | public function isType(string $type) : bool |
277 | 277 | { |
278 | - foreach($this->results as $result) |
|
278 | + foreach ($this->results as $result) |
|
279 | 279 | { |
280 | - if($result->isType($type)) |
|
280 | + if ($result->isType($type)) |
|
281 | 281 | { |
282 | 282 | return true; |
283 | 283 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $lines[] = 'Collection #'.$this->getID(); |
294 | 294 | $lines[] = 'Subject: '.get_class($this->subject); |
295 | 295 | |
296 | - foreach($this->results as $result) |
|
296 | + foreach ($this->results as $result) |
|
297 | 297 | { |
298 | 298 | $lines[] = ' - '.$result->getType().' #'.$result->getCode().' "'.$result->getMessage($result->getType()).'"'; |
299 | 299 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @param string $message Should not contain a date, just the system specific info. |
145 | 145 | * @return $this |
146 | 146 | */ |
147 | - public function makeSuccess(string $message, int $code=0) : OperationResult |
|
147 | + public function makeSuccess(string $message, int $code = 0) : OperationResult |
|
148 | 148 | { |
149 | 149 | return $this->setMessage(self::TYPE_SUCCESS, $message, $code, true); |
150 | 150 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @param string $message Should be as detailed as possible. |
156 | 156 | * @return $this |
157 | 157 | */ |
158 | - public function makeError(string $message, int $code=0) : OperationResult |
|
158 | + public function makeError(string $message, int $code = 0) : OperationResult |
|
159 | 159 | { |
160 | 160 | return $this->setMessage(self::TYPE_ERROR, $message, $code, false); |
161 | 161 | } |
@@ -252,11 +252,11 @@ discard block |
||
252 | 252 | return $this->code; |
253 | 253 | } |
254 | 254 | |
255 | - public function getMessage(string $type='') : string |
|
255 | + public function getMessage(string $type = '') : string |
|
256 | 256 | { |
257 | - if(!empty($type)) |
|
257 | + if (!empty($type)) |
|
258 | 258 | { |
259 | - if($this->type === $type) |
|
259 | + if ($this->type === $type) |
|
260 | 260 | { |
261 | 261 | return $this->message; |
262 | 262 | } |
@@ -280,11 +280,11 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @throws ConvertHelper_Exception |
282 | 282 | */ |
283 | - public function makeException(Throwable $e, int $code=0, bool $withDeveloperInfo=false) : OperationResult |
|
283 | + public function makeException(Throwable $e, int $code = 0, bool $withDeveloperInfo = false) : OperationResult |
|
284 | 284 | { |
285 | 285 | $info = parseThrowable($e); |
286 | 286 | |
287 | - if($code === 0) |
|
287 | + if ($code === 0) |
|
288 | 288 | { |
289 | 289 | $code = $info->getCode(); |
290 | 290 | } |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | * @see Microtime::createFromString() |
115 | 115 | * @see Microtime::createNow() |
116 | 116 | */ |
117 | - public function __construct($datetime=self::DATETIME_NOW, ?DateTimeZone $timeZone=null) |
|
117 | + public function __construct($datetime = self::DATETIME_NOW, ?DateTimeZone $timeZone = null) |
|
118 | 118 | { |
119 | - if($datetime instanceof Microtime_ParseResult) |
|
119 | + if ($datetime instanceof Microtime_ParseResult) |
|
120 | 120 | { |
121 | 121 | $parsed = $datetime; |
122 | 122 | } |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | * @return Microtime_ParseResult |
149 | 149 | * @throws Microtime_Exception |
150 | 150 | */ |
151 | - private function parseDate($datetime, ?DateTimeZone $timeZone=null) : Microtime_ParseResult |
|
151 | + private function parseDate($datetime, ?DateTimeZone $timeZone = null) : Microtime_ParseResult |
|
152 | 152 | { |
153 | - if($datetime instanceof Microtime) |
|
153 | + if ($datetime instanceof Microtime) |
|
154 | 154 | { |
155 | 155 | return new Microtime_ParseResult( |
156 | 156 | $datetime->getISODate(), |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | ); |
159 | 159 | } |
160 | 160 | |
161 | - if($datetime instanceof DateTime) |
|
161 | + if ($datetime instanceof DateTime) |
|
162 | 162 | { |
163 | 163 | return new Microtime_ParseResult( |
164 | 164 | $datetime->format(self::FORMAT_ISO), |
@@ -166,17 +166,17 @@ discard block |
||
166 | 166 | ); |
167 | 167 | } |
168 | 168 | |
169 | - if($timeZone === null) |
|
169 | + if ($timeZone === null) |
|
170 | 170 | { |
171 | 171 | $timeZone = new DateTimeZone(date_default_timezone_get()); |
172 | 172 | } |
173 | 173 | |
174 | - if(empty($datetime) || $datetime === self::DATETIME_NOW) |
|
174 | + if (empty($datetime) || $datetime === self::DATETIME_NOW) |
|
175 | 175 | { |
176 | 176 | return self::parseNow($timeZone); |
177 | 177 | } |
178 | 178 | |
179 | - if(is_string($datetime)) |
|
179 | + if (is_string($datetime)) |
|
180 | 180 | { |
181 | 181 | return new Microtime_ParseResult( |
182 | 182 | $datetime, |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | { |
204 | 204 | $dateObj = DateTime::createFromFormat('0.u00 U', microtime(), new DateTimeZone('America/Denver')); |
205 | 205 | |
206 | - if($dateObj !== false) |
|
206 | + if ($dateObj !== false) |
|
207 | 207 | { |
208 | 208 | $dateObj->setTimezone($timeZone); |
209 | 209 | |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | * @return Microtime |
228 | 228 | * @throws Microtime_Exception |
229 | 229 | */ |
230 | - public static function createNow(?DateTimeZone $timeZone=null) : Microtime |
|
230 | + public static function createNow(?DateTimeZone $timeZone = null) : Microtime |
|
231 | 231 | { |
232 | - if($timeZone === null) |
|
232 | + if ($timeZone === null) |
|
233 | 233 | { |
234 | 234 | $timeZone = new DateTimeZone(date_default_timezone_get()); |
235 | 235 | } |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | * @return Microtime |
247 | 247 | * @throws Microtime_Exception |
248 | 248 | */ |
249 | - public static function createFromString(string $date, ?DateTimeZone $timeZone=null) : Microtime |
|
249 | + public static function createFromString(string $date, ?DateTimeZone $timeZone = null) : Microtime |
|
250 | 250 | { |
251 | - if($timeZone === null) |
|
251 | + if ($timeZone === null) |
|
252 | 252 | { |
253 | 253 | $timeZone = new DateTimeZone(date_default_timezone_get()); |
254 | 254 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | protected function __construct($subject) |
82 | 82 | { |
83 | - if(is_array($subject)) |
|
83 | + if (is_array($subject)) |
|
84 | 84 | { |
85 | 85 | $this->parseSerialized($subject); |
86 | 86 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function getPrevious() : ConvertHelper_ThrowableInfo |
141 | 141 | { |
142 | - if(isset($this->previous)) { |
|
142 | + if (isset($this->previous)) { |
|
143 | 143 | return $this->previous; |
144 | 144 | } |
145 | 145 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | public function getFolderDepth() : int |
259 | 259 | { |
260 | 260 | $depth = $this->getOption('folder-depth'); |
261 | - if(!empty($depth)) { |
|
261 | + if (!empty($depth)) { |
|
262 | 262 | return $depth; |
263 | 263 | } |
264 | 264 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | |
316 | 316 | $this->setOptions($serialized[ConvertHelper_ThrowableInfo_Serializer::SERIALIZED_OPTIONS]); |
317 | 317 | |
318 | - foreach($serialized[ConvertHelper_ThrowableInfo_Serializer::SERIALIZED_CALLS] as $def) |
|
318 | + foreach ($serialized[ConvertHelper_ThrowableInfo_Serializer::SERIALIZED_CALLS] as $def) |
|
319 | 319 | { |
320 | 320 | $this->calls[] = ConvertHelper_ThrowableInfo_Call::fromSerialized($this, $def); |
321 | 321 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $this->date = new Microtime(); |
327 | 327 | $this->class = get_class($e); |
328 | 328 | |
329 | - if($e instanceof BaseException) |
|
329 | + if ($e instanceof BaseException) |
|
330 | 330 | { |
331 | 331 | $this->details = $e->getDetails(); |
332 | 332 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * @return string |
360 | 360 | * @throws ConvertHelper_Exception |
361 | 361 | */ |
362 | - public function renderErrorMessage(bool $withDeveloperInfo=false) : string |
|
362 | + public function renderErrorMessage(bool $withDeveloperInfo = false) : string |
|
363 | 363 | { |
364 | 364 | return (new ConvertHelper_ThrowableInfo_MessageRenderer($this, $withDeveloperInfo)) |
365 | 365 | ->render(); |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | } |
436 | 436 | else |
437 | 437 | { |
438 | - $this->message = 'Original error code: [' . $code . ']. ' . $this->message; |
|
438 | + $this->message = 'Original error code: ['.$code.']. '.$this->message; |
|
439 | 439 | } |
440 | 440 | } |
441 | 441 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | ->t('Message:') |
39 | 39 | ->add($this->info->getMessage()); |
40 | 40 | |
41 | - if($this->developerInfo) |
|
41 | + if ($this->developerInfo) |
|
42 | 42 | { |
43 | 43 | $message |
44 | 44 | ->eol() |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | ->add($finalCall->toString()); |
47 | 47 | } |
48 | 48 | |
49 | - if($this->developerInfo && $this->info->hasDetails()) |
|
49 | + if ($this->developerInfo && $this->info->hasDetails()) |
|
50 | 50 | { |
51 | 51 | $message |
52 | 52 | ->t('Developer details:') |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | ->add($this->info->getDetails()); |
55 | 55 | } |
56 | 56 | |
57 | - if($this->info->hasPrevious()) |
|
57 | + if ($this->info->hasPrevious()) |
|
58 | 58 | { |
59 | 59 | $message |
60 | 60 | ->eol() |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | public function toString() : string |
20 | 20 | { |
21 | 21 | return |
22 | - $this->renderMessage() . |
|
23 | - $this->renderCalls() . |
|
22 | + $this->renderMessage(). |
|
23 | + $this->renderCalls(). |
|
24 | 24 | $this->renderPrevious(); |
25 | 25 | } |
26 | 26 | |
@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | |
34 | 34 | if ($this->info->hasCode()) |
35 | 35 | { |
36 | - $string .= ' #' . $this->info->getCode(); |
|
36 | + $string .= ' #'.$this->info->getCode(); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | $string .= |
40 | - ': ' . |
|
41 | - $this->info->getMessage() . |
|
40 | + ': '. |
|
41 | + $this->info->getMessage(). |
|
42 | 42 | PHP_EOL; |
43 | 43 | |
44 | 44 | return $string; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | foreach ($calls as $call) |
57 | 57 | { |
58 | - $string .= $call->toString() . PHP_EOL; |
|
58 | + $string .= $call->toString().PHP_EOL; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | return $string; |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | return |
76 | - PHP_EOL . |
|
77 | - PHP_EOL . |
|
78 | - 'Previous error:' . |
|
79 | - PHP_EOL . |
|
80 | - PHP_EOL . |
|
76 | + PHP_EOL. |
|
77 | + PHP_EOL. |
|
78 | + 'Previous error:'. |
|
79 | + PHP_EOL. |
|
80 | + PHP_EOL. |
|
81 | 81 | $this->info->getPrevious()->toString(); |
82 | 82 | } |
83 | 83 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param bool $lowercase |
62 | 62 | * @return Transliteration |
63 | 63 | */ |
64 | - public function setLowercase(bool $lowercase=true) : Transliteration |
|
64 | + public function setLowercase(bool $lowercase = true) : Transliteration |
|
65 | 65 | { |
66 | 66 | $this->setOption(self::OPTION_LOWER_CASE, $lowercase); |
67 | 67 | |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | |
100 | 100 | $result = implode('', $keep); |
101 | 101 | |
102 | - while (strpos($result, $space . $space) !== false) { |
|
103 | - $result = str_replace($space . $space, $space, $result); |
|
102 | + while (strpos($result, $space.$space) !== false) { |
|
103 | + $result = str_replace($space.$space, $space, $result); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | $result = trim($result, $space); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param string|number|StringBuilder_Interface|NULL $content |
30 | 30 | * @return HTMLTag |
31 | 31 | */ |
32 | - public static function anchor(string $url, $content=null) : HTMLTag |
|
32 | + public static function anchor(string $url, $content = null) : HTMLTag |
|
33 | 33 | { |
34 | 34 | return HTMLTag::create('a') |
35 | 35 | ->href($url) |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param string|number|StringBuilder_Interface|NULL $content |
47 | 47 | * @return HTMLTag |
48 | 48 | */ |
49 | - public static function div($content=null) : HTMLTag |
|
49 | + public static function div($content = null) : HTMLTag |
|
50 | 50 | { |
51 | 51 | return HTMLTag::create('div')->setContent($content); |
52 | 52 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param string|number|StringBuilder_Interface|NULL $content |
56 | 56 | * @return HTMLTag |
57 | 57 | */ |
58 | - public static function p($content=null) : HTMLTag |
|
58 | + public static function p($content = null) : HTMLTag |
|
59 | 59 | { |
60 | 60 | return HTMLTag::create('p')->setContent($content); |
61 | 61 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | public function __construct() |
38 | 38 | { |
39 | - if(class_exists('\AppLocalize\Localization')) { |
|
39 | + if (class_exists('\AppLocalize\Localization')) { |
|
40 | 40 | \AppLocalize\Localization::onLocaleChanged(array($this, 'handle_localeChanged')); |
41 | 41 | } |
42 | 42 | } |
@@ -69,17 +69,17 @@ discard block |
||
69 | 69 | $keep = $this->resolveTokens($interval); |
70 | 70 | |
71 | 71 | $parts = array(); |
72 | - foreach($keep as $token) |
|
72 | + foreach ($keep as $token) |
|
73 | 73 | { |
74 | 74 | $value = $interval->getToken($token); |
75 | - if($value <= 0) { |
|
75 | + if ($value <= 0) { |
|
76 | 76 | continue; |
77 | 77 | } |
78 | 78 | |
79 | 79 | $parts[] = $this->translateToken($token, $interval); |
80 | 80 | } |
81 | 81 | |
82 | - if(count($parts) == 1) { |
|
82 | + if (count($parts) == 1) { |
|
83 | 83 | return $parts[0]; |
84 | 84 | } |
85 | 85 | |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | $value = $interval->getToken($token); |
102 | 102 | |
103 | 103 | $suffix = 'p'; |
104 | - if($value == 1) { $suffix = 's'; } |
|
104 | + if ($value == 1) { $suffix = 's'; } |
|
105 | 105 | $token .= $suffix; |
106 | 106 | |
107 | - if(!isset(self::$texts[$token])) |
|
107 | + if (!isset(self::$texts[$token])) |
|
108 | 108 | { |
109 | 109 | throw new ConvertHelper_Exception( |
110 | 110 | 'Missing interval translation', |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | { |
135 | 135 | $offset = 0; |
136 | 136 | |
137 | - foreach($this->tokens as $token) |
|
137 | + foreach ($this->tokens as $token) |
|
138 | 138 | { |
139 | - if($interval->getToken($token) > 0) |
|
139 | + if ($interval->getToken($token) > 0) |
|
140 | 140 | { |
141 | 141 | return array_slice($this->tokens, $offset); |
142 | 142 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | protected function initTexts() : void |
154 | 154 | { |
155 | - if(isset(self::$texts)) { |
|
155 | + if (isset(self::$texts)) { |
|
156 | 156 | return; |
157 | 157 | } |
158 | 158 |