Passed
Push — master ( c49a71...1dce7e )
by Sebastian
04:29
created
src/SVNHelper/Command/Update.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
     {
11 11
         $result = $this->execCommand('update', $this->target->getPath());
12 12
         
13
-        if($result->isError()) {
13
+        if ($result->isError()) {
14 14
             $this->throwExceptionUnexpected($result);
15 15
         }
16 16
         
17 17
         $this->parseResult($result);
18 18
         
19
-        if(!isset($this->revision)) {
19
+        if (!isset($this->revision)) {
20 20
             $this->throwException(
21 21
                 'No update revision returned',
22 22
                 'The command did not return the expected last line with "at revision x".',
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         
46 46
         $lines = $result->getLines();
47 47
         
48
-        foreach($lines as $line) 
48
+        foreach ($lines as $line) 
49 49
         {
50 50
             $result = array();
51 51
             preg_match_all('/\A(a|c|d|u)[ ]+(.+)/si', $line, $result, PREG_PATTERN_ORDER);
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
             // is this a file update status line? It looks like this:
54 54
             // a    c:\path\to\file.ext
55 55
             // ^ status code
56
-            if(isset($result[0]) && isset($result[1][0]) && !empty($result[1][0])) 
56
+            if (isset($result[0]) && isset($result[1][0]) && !empty($result[1][0])) 
57 57
             {
58 58
                 $status = $result[1][0];
59 59
                 $path = $result[2][0];
60 60
                 $obj = new SVNHelper_Command_Update_Status($this, $status, $path);
61 61
                 
62
-                if(!isset($this->stati[$status])) {
62
+                if (!isset($this->stati[$status])) {
63 63
                     $this->stati[$status] = array();
64 64
                 }
65 65
                 
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
             }
70 70
             
71 71
             // the revision line, "updated to revision X" or "at revision X"
72
-            if(strstr($line, 'revision ')) {
72
+            if (strstr($line, 'revision ')) {
73 73
                 preg_match('/(at revision|to revision) ([0-9]+)/si', $line, $result);
74
-                if(isset($result[2])) {
74
+                if (isset($result[2])) {
75 75
                     $this->revision = $result[2];
76 76
                 }
77 77
                 continue;
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     {
136 136
         $this->execute();
137 137
         
138
-        if(isset($this->stati[$status])) {
138
+        if (isset($this->stati[$status])) {
139 139
             return $this->stati[$status];
140 140
         }
141 141
         
Please login to merge, or discard this patch.
src/SVNHelper/Command/Status.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
     {
50 50
         $result = $this->execCommand('status', $this->target->getPath(), array('depth empty'));
51 51
         
52
-        if($result->isError()) {
52
+        if ($result->isError()) {
53 53
             $this->throwExceptionUnexpected($result);
54 54
         }
55 55
 
56 56
         $lines = $result->getOutput();
57 57
         
58
-        if(empty($lines)) 
58
+        if (empty($lines)) 
59 59
         {
60 60
             $this->status = self::STATUS_NOT_MODIFIED;
61 61
         }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             $this->status = self::STATUS_UNKNOWN;
65 65
             
66 66
             $svnStatusCode = strtolower(substr($lines[0], 0, 1));
67
-            if(isset(self::$knownStati[$svnStatusCode])) {
67
+            if (isset(self::$knownStati[$svnStatusCode])) {
68 68
                $this->status = self::$knownStati[$svnStatusCode];
69 69
             }
70 70
         }
Please login to merge, or discard this patch.
src/ConvertHelper/ThrowableInfo.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     
62 62
     protected function __construct($subject)
63 63
     {
64
-        if(is_array($subject))
64
+        if (is_array($subject))
65 65
         {
66 66
             $this->parseSerialized($subject);
67 67
         }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     */
116 116
     public function getPrevious() : ConvertHelper_ThrowableInfo
117 117
     {
118
-        if(isset($this->previous)) {
118
+        if (isset($this->previous)) {
119 119
             return $this->previous;
120 120
         }
121 121
         
@@ -140,18 +140,18 @@  discard block
 block discarded – undo
140 140
         
141 141
         $string = 'Exception';
142 142
         
143
-        if($this->hasCode()) {
143
+        if ($this->hasCode()) {
144 144
             $string .= ' #'.$this->code;
145 145
         }
146 146
         
147 147
         $string .= ': '.$this->getMessage().PHP_EOL;
148 148
         
149
-        foreach($calls as $call) 
149
+        foreach ($calls as $call) 
150 150
         {
151 151
             $string .= $call->toString().PHP_EOL;
152 152
         }
153 153
         
154
-        if($this->hasPrevious())
154
+        if ($this->hasPrevious())
155 155
         {
156 156
             $string .= PHP_EOL.PHP_EOL.
157 157
             'Previous error:'.PHP_EOL.PHP_EOL.
@@ -233,11 +233,11 @@  discard block
 block discarded – undo
233 233
             'previous' => null,
234 234
         );
235 235
         
236
-        if($this->hasPrevious()) {
237
-            $result['previous'] =  $this->previous->serialize();
236
+        if ($this->hasPrevious()) {
237
+            $result['previous'] = $this->previous->serialize();
238 238
         }
239 239
         
240
-        foreach($this->calls as $call)
240
+        foreach ($this->calls as $call)
241 241
         {
242 242
             $result['calls'][] = $call->serialize(); 
243 243
         }
@@ -287,12 +287,12 @@  discard block
 block discarded – undo
287 287
         
288 288
         $this->setOptions($serialized['options']);
289 289
         
290
-        if(!empty($serialized['previous']))
290
+        if (!empty($serialized['previous']))
291 291
         {
292 292
             $this->previous = ConvertHelper_ThrowableInfo::fromSerialized($serialized['previous']);
293 293
         }
294 294
         
295
-        foreach($serialized['calls'] as $def)
295
+        foreach ($serialized['calls'] as $def)
296 296
         {
297 297
             $this->calls[] = ConvertHelper_ThrowableInfo_Call::fromSerialized($this, $def);
298 298
         }
@@ -304,16 +304,16 @@  discard block
 block discarded – undo
304 304
         $this->message = $e->getMessage();
305 305
         $this->code = intval($e->getCode());
306 306
         
307
-        if(!isset($_REQUEST) || !isset($_REQUEST['REQUEST_URI'])) {
307
+        if (!isset($_REQUEST) || !isset($_REQUEST['REQUEST_URI'])) {
308 308
             $this->context = self::CONTEXT_COMMAND_LINE;
309 309
         }
310 310
         
311 311
         $previous = $e->getPrevious();
312
-        if($previous instanceof \Throwable) {
312
+        if ($previous instanceof \Throwable) {
313 313
             $this->previous = ConvertHelper::throwable2info($previous);
314 314
         }
315 315
         
316
-        if(isset($_SERVER) && isset($_SERVER['REQUEST_URI'])) {
316
+        if (isset($_SERVER) && isset($_SERVER['REQUEST_URI'])) {
317 317
             $this->referer = $_SERVER['REQUEST_URI'];
318 318
         }
319 319
         
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
         
328 328
         $idx = 1;
329 329
         
330
-        foreach($trace as $entry)
330
+        foreach ($trace as $entry)
331 331
         {
332 332
             $this->calls[] = ConvertHelper_ThrowableInfo_Call::fromTrace($this, $idx, $entry);
333 333
             
Please login to merge, or discard this patch.
src/ConvertHelper/ThrowableInfo/Call.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     {
63 63
         $this->info = $info;
64 64
         
65
-        if(isset($data['serialized'])) 
65
+        if (isset($data['serialized'])) 
66 66
         {
67 67
             $this->parseSerialized($data['serialized']);
68 68
         }
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
             $this->position = $data['position'];
73 73
         }
74 74
         
75
-        if($this->hasClass()) 
75
+        if ($this->hasClass()) 
76 76
         {
77 77
             $this->type = self::TYPE_METHOD_CALL;
78 78
         }
79
-        else if($this->hasFunction()) 
79
+        else if ($this->hasFunction()) 
80 80
         {
81 81
             $this->type = self::TYPE_FUNCTION_CALL;
82 82
         }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     
136 136
     public function getFileName() : string
137 137
     {
138
-        if($this->hasFile()) {
138
+        if ($this->hasFile()) {
139 139
             return basename($this->file);
140 140
         }
141 141
         
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     
145 145
     public function getFileRelative() : string
146 146
     {
147
-        if($this->hasFile()) {
147
+        if ($this->hasFile()) {
148 148
             return FileHelper::relativizePathByDepth($this->file, $this->info->getFolderDepth());
149 149
         }
150 150
         
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
         $this->class = $data['class'];
171 171
         $this->position = $data['position'];
172 172
         
173
-        foreach($data['arguments'] as $arg)
173
+        foreach ($data['arguments'] as $arg)
174 174
         {
175 175
             $this->args[] = VariableInfo::fromSerialized($arg);
176 176
         }
@@ -178,29 +178,29 @@  discard block
 block discarded – undo
178 178
     
179 179
     protected function parseTrace(array $trace)
180 180
     {
181
-        if(isset($trace['line']))
181
+        if (isset($trace['line']))
182 182
         {
183 183
             $this->line = intval($trace['line']);
184 184
         }
185 185
         
186
-        if(isset($trace['function'])) 
186
+        if (isset($trace['function'])) 
187 187
         {
188 188
             $this->function = $trace['function'];
189 189
         }
190 190
         
191
-        if(isset($trace['file']))
191
+        if (isset($trace['file']))
192 192
         {
193 193
             $this->file = FileHelper::normalizePath($trace['file']);
194 194
         }
195 195
         
196
-        if(isset($trace['class'])) 
196
+        if (isset($trace['class'])) 
197 197
         {
198 198
             $this->class = $trace['class'];
199 199
         }
200 200
      
201
-        if(isset($trace['args']) && !empty($trace['args']))
201
+        if (isset($trace['args']) && !empty($trace['args']))
202 202
         {
203
-            foreach($trace['args'] as $arg) 
203
+            foreach ($trace['args'] as $arg) 
204 204
             {
205 205
                 $this->args[] = parseVariable($arg);
206 206
             }
@@ -215,13 +215,13 @@  discard block
 block discarded – undo
215 215
         
216 216
         $tokens[] = '#'.sprintf('%0'.$padLength.'d', $this->getPosition()).' ';
217 217
         
218
-        if($this->hasFile()) {
218
+        if ($this->hasFile()) {
219 219
             $tokens[] = $this->getFileRelative().':'.$this->getLine();
220 220
         }
221 221
         
222
-        if($this->hasClass()) {
222
+        if ($this->hasClass()) {
223 223
             $tokens[] = $this->getClass().'::'.$this->getFunction().'('.$this->argumentsToString().')';
224
-        } else if($this->hasFunction()) {
224
+        } else if ($this->hasFunction()) {
225 225
             $tokens[] = $this->getFunction().'('.$this->argumentsToString().')';
226 226
         }
227 227
         
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
     {
233 233
         $tokens = array();
234 234
         
235
-        foreach($this->args as $arg) 
235
+        foreach ($this->args as $arg) 
236 236
         {
237 237
             $tokens[] = $arg->toString();
238 238
         }
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
             'arguments' => array()
278 278
         );
279 279
         
280
-        foreach($this->args as $argument)
280
+        foreach ($this->args as $argument)
281 281
         {
282 282
             $result['arguments'][] = $argument->serialize();
283 283
         }
Please login to merge, or discard this patch.
src/Request.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
     public function getParam($name, $default = null)
75 75
     {
76 76
         $value = $default;
77
-        if(isset($_REQUEST[$name])) {
77
+        if (isset($_REQUEST[$name])) {
78 78
             $value = $_REQUEST[$name];
79 79
         }
80 80
         
81
-        if(isset($this->knownParams[$name])) {
81
+        if (isset($this->knownParams[$name])) {
82 82
             $value = $this->knownParams[$name]->validate($value);
83 83
         }
84 84
         
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
     
116 116
     public function getRefreshParams($params = array(), $exclude = array())
117 117
     {
118
-        if(empty($params)) { $params = array(); }
119
-        if(empty($exclude)) { $exclude = array(); }
118
+        if (empty($params)) { $params = array(); }
119
+        if (empty($exclude)) { $exclude = array(); }
120 120
         
121 121
         $vars = $_REQUEST;
122 122
 
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
         // remove the quickform form variable if present, to 
137 137
         // avoid redirect loops when using the refresh URL in
138 138
         // a page in which a form has been submitted.
139
-        foreach($names as $name) {
140
-            if(strstr($name, '_qf__')) {
139
+        foreach ($names as $name) {
140
+            if (strstr($name, '_qf__')) {
141 141
                 unset($vars[$name]);
142 142
                 break;
143 143
             }
@@ -164,13 +164,13 @@  discard block
 block discarded – undo
164 164
      * @param string $dispatcher Relative path to script to use for the URL. Append trailing slash if needed.
165 165
      * @return string
166 166
      */
167
-    public function buildURL($params = array(), $dispatcher=null)
167
+    public function buildURL($params = array(), $dispatcher = null)
168 168
     {
169
-        $url = rtrim(APP_URL, '/') . '/' . $dispatcher;
169
+        $url = rtrim(APP_URL, '/').'/'.$dispatcher;
170 170
         
171 171
         // append any leftover parameters to the end of the URL
172 172
         if (!empty($params)) {
173
-            $url .= '?' . http_build_query($params, null, '&');
173
+            $url .= '?'.http_build_query($params, null, '&');
174 174
         }
175 175
         
176 176
         return $url;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      */
187 187
     public function registerParam($name)
188 188
     {
189
-        if(!isset($this->knownParams[$name])) {
189
+        if (!isset($this->knownParams[$name])) {
190 190
             $param = new Request_Param($this, $name);
191 191
             $this->knownParams[$name] = $param;
192 192
         }
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
     */
204 204
     public function getRegisteredParam(string $name) : Request_Param
205 205
     {
206
-        if(isset($this->knownParams[$name])) {
206
+        if (isset($this->knownParams[$name])) {
207 207
             return $this->knownParams[$name];
208 208
         }
209 209
         
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
             {
271 271
                 $entry['type'] = $matches[1];
272 272
                 
273
-                if(isset($matches[2]) && !empty($matches[2])) 
273
+                if (isset($matches[2]) && !empty($matches[2])) 
274 274
                 {
275 275
                     $params = ConvertHelper::parseQueryString($matches[2]);
276 276
                     $entry['params'] = $params;
277 277
                      
278
-                    if(isset($params['q'])) {
278
+                    if (isset($params['q'])) {
279 279
                         $entry['quality'] = (double)$params['q'];
280 280
                     }
281 281
                 }
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
     {
329 329
         $_REQUEST[$name] = $value;
330 330
         
331
-        if(isset($this->knownParams[$name])) {
331
+        if (isset($this->knownParams[$name])) {
332 332
             unset($this->knownParams[$name]);
333 333
         }
334 334
         
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
     */
363 363
     public function removeParam(string $name) : Request
364 364
     {
365
-        if(isset($_REQUEST[$name])) {
365
+        if (isset($_REQUEST[$name])) {
366 366
             unset($_REQUEST[$name]);
367 367
         }
368 368
         
369
-        if(isset($this->knownParams[$name])) {
369
+        if (isset($this->knownParams[$name])) {
370 370
             unset($this->knownParams[$name]);
371 371
         }
372 372
         
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
     */
382 382
     public function removeParams(array $names) : Request
383 383
     {
384
-        foreach($names as $name) {
384
+        foreach ($names as $name) {
385 385
             $this->removeParam($name);
386 386
         }
387 387
         
@@ -397,10 +397,10 @@  discard block
 block discarded – undo
397 397
      * @param string $name
398 398
      * @return bool
399 399
      */
400
-    public function getBool($name, $default=false)
400
+    public function getBool($name, $default = false)
401 401
     {
402 402
         $value = $this->getParam($name, $default);
403
-        if(ConvertHelper::isBoolean($value)) {
403
+        if (ConvertHelper::isBoolean($value)) {
404 404
             return ConvertHelper::string2bool($value);
405 405
         }
406 406
         
@@ -409,9 +409,9 @@  discard block
 block discarded – undo
409 409
     
410 410
     public function validate()
411 411
     {
412
-        foreach($this->knownParams as $param) {
412
+        foreach ($this->knownParams as $param) {
413 413
             $name = $param->getName();
414
-            if($param->isRequired() && !$this->hasParam($name)) {
414
+            if ($param->isRequired() && !$this->hasParam($name)) {
415 415
                 throw new Request_Exception(
416 416
                     'Missing request parameter '.$name,
417 417
                     sprintf(
@@ -433,10 +433,10 @@  discard block
 block discarded – undo
433 433
      * @param mixed $default
434 434
      * @return string
435 435
      */
436
-    public function getFilteredParam($name, $default=null)
436
+    public function getFilteredParam($name, $default = null)
437 437
     {
438 438
         $val = $this->getParam($name, $default);
439
-        if(is_string($val)) {
439
+        if (is_string($val)) {
440 440
             $val = htmlspecialchars(trim(strip_tags($val)), ENT_QUOTES, 'UTF-8');
441 441
         }
442 442
         
@@ -455,24 +455,24 @@  discard block
 block discarded – undo
455 455
     * @see Request::getJSONAssoc()
456 456
     * @see Request::getJSONObject()
457 457
     */
458
-    public function getJSON(string $name, bool $assoc=true)
458
+    public function getJSON(string $name, bool $assoc = true)
459 459
     {
460 460
         $value = $this->getParam($name);
461 461
         
462
-        if(!empty($value) && is_string($value)) 
462
+        if (!empty($value) && is_string($value)) 
463 463
         {
464 464
             $data = json_decode($value, $assoc);
465 465
             
466
-            if($assoc && is_array($data)) {
466
+            if ($assoc && is_array($data)) {
467 467
                 return $data;
468 468
             }
469 469
             
470
-            if(is_object($data)) {
470
+            if (is_object($data)) {
471 471
                 return $data;
472 472
             }
473 473
         }
474 474
         
475
-        if($assoc) {
475
+        if ($assoc) {
476 476
             return array();
477 477
         }
478 478
         
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
     public static function sendJSON($data)
512 512
     {
513 513
         $payload = $data;
514
-        if(!is_string($payload)) {
514
+        if (!is_string($payload)) {
515 515
             $payload = json_encode($payload);
516 516
         }
517 517
         
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
     * @param array $limitParams Whether to limit the comparison to these specific parameter names (if present)
542 542
     * @return Request_URLComparer
543 543
     */
544
-    public function createURLComparer(string $sourceURL, string $targetURL, array $limitParams=array()) : Request_URLComparer
544
+    public function createURLComparer(string $sourceURL, string $targetURL, array $limitParams = array()) : Request_URLComparer
545 545
     {
546 546
         $comparer = new Request_URLComparer($this, $sourceURL, $targetURL);
547 547
         $comparer->addLimitParams($limitParams);
Please login to merge, or discard this patch.
src/XMLHelper/Converter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     */
114 114
     public function toJSON() : string
115 115
     {
116
-        if(isset($this->json)) {
116
+        if (isset($this->json)) {
117 117
             return $this->json;
118 118
         }
119 119
         
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         
124 124
         unset($this->xml);
125 125
         
126
-        if($this->json !== false) {
126
+        if ($this->json !== false) {
127 127
             return $this->json;
128 128
         }
129 129
         
Please login to merge, or discard this patch.
src/XMLHelper/SimpleXML.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
         // add any errors that were triggered, using the
53 53
         // error wrappers.
54 54
         $errors = libxml_get_errors();
55
-        foreach($errors as $error) {
55
+        foreach ($errors as $error) {
56 56
             $this->errors[] = new XMLHelper_SimpleXML_Error($this, $error);
57 57
         }
58 58
         
Please login to merge, or discard this patch.
src/Request/URLComparer.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     
32 32
     public function addLimitParam(string $name) : Request_URLComparer
33 33
     {
34
-        if(!in_array($name, $this->limitParams)) {
34
+        if (!in_array($name, $this->limitParams)) {
35 35
             $this->limitParams[] = $name;
36 36
         }
37 37
         
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
     
41 41
     public function addLimitParams(array $names) : Request_URLComparer
42 42
     {
43
-        foreach($names as $name) {
43
+        foreach ($names as $name) {
44 44
             $this->addLimitParam($name);
45 45
         }
46 46
         
47 47
         return $this;
48 48
     }
49 49
     
50
-    public function setIgnoreFragment(bool $ignore=true) : Request_URLComparer
50
+    public function setIgnoreFragment(bool $ignore = true) : Request_URLComparer
51 51
     {
52 52
         $this->ignoreFragment = $ignore;
53 53
         return $this;
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     
56 56
     protected function init()
57 57
     {
58
-        if(isset($this->isMatch)) {
58
+        if (isset($this->isMatch)) {
59 59
             return;
60 60
         }
61 61
         
@@ -77,25 +77,25 @@  discard block
 block discarded – undo
77 77
             'query' 
78 78
         );
79 79
         
80
-        if(!$this->ignoreFragment) {
80
+        if (!$this->ignoreFragment) {
81 81
             $keys[] = 'fragment';
82 82
         }
83 83
         
84
-        foreach($keys as $key)
84
+        foreach ($keys as $key)
85 85
         {
86 86
             $sVal = '';
87 87
             $tVal = '';
88 88
             
89
-            if(isset($sInfo[$key])) { $sVal = $sInfo[$key]; }
90
-            if(isset($tInfo[$key])) { $tVal = $tInfo[$key]; }
89
+            if (isset($sInfo[$key])) { $sVal = $sInfo[$key]; }
90
+            if (isset($tInfo[$key])) { $tVal = $tInfo[$key]; }
91 91
             
92 92
             $filter = 'filter_'.$key;
93
-            if(method_exists($this, $filter)) {
93
+            if (method_exists($this, $filter)) {
94 94
                 $sVal = $this->$filter($sVal);
95 95
                 $tVal = $this->$filter($tVal);
96 96
             }
97 97
             
98
-            if($sVal !== $tVal) {
98
+            if ($sVal !== $tVal) {
99 99
                 return false;
100 100
             }
101 101
         }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     protected function filter_path(string $path) : string
107 107
     {
108 108
         // fix double slashes in URLs
109
-        while(stristr($path, '//')) {
109
+        while (stristr($path, '//')) {
110 110
             $path = str_replace('//', '/', $path);
111 111
         }
112 112
         
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     
116 116
     protected function filter_query(string $query) : string
117 117
     {
118
-        if(empty($query)) {
118
+        if (empty($query)) {
119 119
             return '';
120 120
         }
121 121
         
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
         
124 124
         ksort($params);
125 125
         
126
-        if(!empty($this->limitParams))
126
+        if (!empty($this->limitParams))
127 127
         {
128 128
             $keep = array();
129 129
             
130
-            foreach($this->limitParams as $name)
130
+            foreach ($this->limitParams as $name)
131 131
             {
132
-                if(isset($params[$name])) {
132
+                if (isset($params[$name])) {
133 133
                     $keep[$name] = $params[$name];
134 134
                 }
135 135
             }
Please login to merge, or discard this patch.
src/Request/Param.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
     * @param array $args
124 124
     * @return Request_Param
125 125
     */
126
-    public function setCallback($callback, $args=array())
126
+    public function setCallback($callback, $args = array())
127 127
     {
128
-        if(!is_callable($callback)) {
128
+        if (!is_callable($callback)) {
129 129
             throw new Request_Exception(
130 130
                 'Not a valid callback',
131 131
                 'The specified callback is not a valid callable entity.',
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         array_unshift($args, $value);
149 149
         
150 150
         $result = call_user_func_array($this->validationParams['callback'], $args);
151
-        if($result !== false) {
151
+        if ($result !== false) {
152 152
             return $value;
153 153
         }
154 154
         
@@ -175,13 +175,13 @@  discard block
 block discarded – undo
175 175
         
176 176
         // go through all enqueued validations in turn, each time
177 177
         // replacing the value with the adjusted, validated value.
178
-        foreach($this->validations as $validateDef) 
178
+        foreach ($this->validations as $validateDef) 
179 179
         {
180 180
             $this->validationType = $validateDef['type'];
181 181
             $this->validationParams = $validateDef['params'];
182 182
             
183 183
             // and now, see if we have to validate the value as well
184
-            $method = 'validate_' . $this->validationType;
184
+            $method = 'validate_'.$this->validationType;
185 185
             if (!method_exists($this, $method)) {
186 186
                 throw new Request_Exception(
187 187
                     'Unknown validation type.',
@@ -195,19 +195,19 @@  discard block
 block discarded – undo
195 195
                 );
196 196
             }
197 197
          
198
-            if($this->valueType === self::VALUE_TYPE_ID_LIST) 
198
+            if ($this->valueType === self::VALUE_TYPE_ID_LIST) 
199 199
             {
200
-                if(!is_array($value)) {
200
+                if (!is_array($value)) {
201 201
                     $value = explode(',', $value);
202 202
                 }
203 203
                 
204 204
                 $keep = array();
205
-                foreach($value as $subval) 
205
+                foreach ($value as $subval) 
206 206
                 {
207 207
                     $subval = trim($subval);
208 208
                     $subval = $this->$method($subval);
209 209
                     
210
-                    if($subval !== null) {
210
+                    if ($subval !== null) {
211 211
                         $keep[] = intval($subval);
212 212
                     }
213 213
                 }
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
     
424 424
     protected function applyFilter_boolean($value)
425 425
     {
426
-        if($value == 'yes' || $value == 'true') {
426
+        if ($value == 'yes' || $value == 'true') {
427 427
             return true;
428 428
         }
429 429
         
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
     
438 438
     protected function applyFilter_string($value)
439 439
     {
440
-        if(!is_scalar($value)) {
440
+        if (!is_scalar($value)) {
441 441
             return '';
442 442
         }
443 443
         
@@ -446,29 +446,29 @@  discard block
 block discarded – undo
446 446
     
447 447
     protected function applyFilter_commaSeparated($value, bool $trimEntries, bool $stripEmptyEntries)
448 448
     {
449
-        if(is_array($value)) {
449
+        if (is_array($value)) {
450 450
             return $value;
451 451
         }
452 452
         
453
-        if($value === '' || $value === null || !is_string($value)) {
453
+        if ($value === '' || $value === null || !is_string($value)) {
454 454
             return array();
455 455
         }
456 456
         
457 457
         $result = explode(',', $value);
458 458
         
459
-        if(!$trimEntries && !$stripEmptyEntries) {
459
+        if (!$trimEntries && !$stripEmptyEntries) {
460 460
             return $result;
461 461
         }
462 462
         
463 463
         $keep = array();
464 464
         
465
-        foreach($result as $entry) 
465
+        foreach ($result as $entry) 
466 466
         {
467
-            if($trimEntries === true) {
467
+            if ($trimEntries === true) {
468 468
                 $entry = trim($entry);
469 469
             }
470 470
             
471
-            if($stripEmptyEntries === true && $entry === '') {
471
+            if ($stripEmptyEntries === true && $entry === '') {
472 472
                 continue;
473 473
             }
474 474
             
@@ -536,10 +536,10 @@  discard block
 block discarded – undo
536 536
     * @param mixed $default
537 537
     * @return mixed
538 538
     */
539
-    public function get($default=null)
539
+    public function get($default = null)
540 540
     {
541 541
         $value = $this->validate($this->request->getParam($this->paramName));
542
-        if($value !== null && $value !== '') {
542
+        if ($value !== null && $value !== '') {
543 543
             return $value;
544 544
         }
545 545
 
@@ -573,12 +573,12 @@  discard block
 block discarded – undo
573 573
     */
574 574
     protected function validate_url($value) : string
575 575
     {
576
-        if(!is_string($value)) {
576
+        if (!is_string($value)) {
577 577
             return '';
578 578
         }
579 579
         
580 580
         $info = parse_url($value);
581
-        if(isset($info['host'])) {
581
+        if (isset($info['host'])) {
582 582
             return $value;
583 583
         }
584 584
         
@@ -632,13 +632,13 @@  discard block
 block discarded – undo
632 632
     
633 633
     protected function validate_valueslist($value)
634 634
     {
635
-        if(!is_array($value)) {
635
+        if (!is_array($value)) {
636 636
             return array();
637 637
         }
638 638
         
639 639
         $keep = array();
640
-        foreach($value as $item) {
641
-            if(in_array($item, $this->validationParams)) {
640
+        foreach ($value as $item) {
641
+            if (in_array($item, $this->validationParams)) {
642 642
                 $keep[] = $item;
643 643
             }
644 644
         }
@@ -695,26 +695,26 @@  discard block
 block discarded – undo
695 695
     */
696 696
     protected function validate_json($value)
697 697
     {
698
-        if(!is_string($value)) {
698
+        if (!is_string($value)) {
699 699
             return '';
700 700
         }
701 701
         
702 702
         $value = trim($value);
703 703
         
704
-        if(empty($value)) {
704
+        if (empty($value)) {
705 705
             return '';
706 706
         }
707 707
         
708 708
         // strictly validate for objects?
709
-        if($this->validationParams['arrays'] === false) 
709
+        if ($this->validationParams['arrays'] === false) 
710 710
         {
711
-            if(is_object(json_decode($value))) {
711
+            if (is_object(json_decode($value))) {
712 712
                return $value; 
713 713
             }
714 714
         } 
715 715
         else 
716 716
         {
717
-            if(is_array(json_decode($value, true))) {
717
+            if (is_array(json_decode($value, true))) {
718 718
                 return $value;
719 719
             }
720 720
         }
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
     {
736 736
         $total = count($this->filters);
737 737
         for ($i = 0; $i < $total; $i++) {
738
-            $method = 'applyFilter_' . $this->filters[$i]['type'];
738
+            $method = 'applyFilter_'.$this->filters[$i]['type'];
739 739
             $value = $this->$method($value, $this->filters[$i]['params']);
740 740
         }
741 741
 
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
     * @param bool $stripEmptyEntries Remove empty entries from the array?
883 883
     * @return \AppUtils\Request_Param
884 884
     */
885
-    public function addCommaSeparatedFilter(bool $trimEntries=true, bool $stripEmptyEntries=true) : Request_Param
885
+    public function addCommaSeparatedFilter(bool $trimEntries = true, bool $stripEmptyEntries = true) : Request_Param
886 886
     {
887 887
         $this->setArray();
888 888
         
Please login to merge, or discard this patch.