Passed
Push — master ( b33de3...cb7df5 )
by Sebastian
02:24
created
src/Request/Param/Validator/Enum.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     
30 30
     protected function _validate()
31 31
     {
32
-        if(in_array($this->value, $this->getArrayOption('values'))) {
32
+        if (in_array($this->value, $this->getArrayOption('values'))) {
33 33
             return $this->value;
34 34
         }
35 35
         
Please login to merge, or discard this patch.
src/Request/Param.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
     * @param array $args
127 127
     * @return Request_Param
128 128
     */
129
-    public function setCallback($callback, array $args=array()) : Request_Param
129
+    public function setCallback($callback, array $args = array()) : Request_Param
130 130
     {
131
-        if(!is_callable($callback)) {
131
+        if (!is_callable($callback)) {
132 132
             throw new Request_Exception(
133 133
                 'Not a valid callback',
134 134
                 'The specified callback is not a valid callable entity.',
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
         
162 162
         // go through all enqueued validations in turn, each time
163 163
         // replacing the value with the adjusted, validated value.
164
-        foreach($this->validations as $validateDef) 
164
+        foreach ($this->validations as $validateDef) 
165 165
         {
166 166
             $value = $this->validateType($value, $validateDef['type'], $validateDef['params']);
167 167
         }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     {
184 184
         $class = '\AppUtils\Request_Param_Validator_'.ucfirst($type);
185 185
         
186
-        if(!class_exists($class))
186
+        if (!class_exists($class))
187 187
         {
188 188
             throw new Request_Exception(
189 189
                 'Unknown validation type.',
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         $validator = new $class($this);
200 200
         $validator->setOptions($params);
201 201
         
202
-        if($this->valueType === self::VALUE_TYPE_ID_LIST)
202
+        if ($this->valueType === self::VALUE_TYPE_ID_LIST)
203 203
         {
204 204
             $value = $this->validateType_idList($value, $validator);
205 205
         }
@@ -213,19 +213,19 @@  discard block
 block discarded – undo
213 213
     
214 214
     protected function validateType_idList($value, Request_Param_Validator $validator) : array
215 215
     {
216
-        if(!is_array($value))
216
+        if (!is_array($value))
217 217
         {
218 218
             $value = explode(',', $value);
219 219
         }
220 220
         
221 221
         $keep = array();
222 222
         
223
-        foreach($value as $subval)
223
+        foreach ($value as $subval)
224 224
         {
225 225
             $subval = trim($subval);
226 226
             $subval = $validator->validate($subval);
227 227
             
228
-            if($subval !== null) {
228
+            if ($subval !== null) {
229 229
                 $keep[] = intval($subval);
230 230
             }
231 231
         }
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
     {
366 366
         $args = func_get_args(); // cannot be used as function parameter in some PHP versions
367 367
         
368
-        if(is_array($args[0])) 
368
+        if (is_array($args[0])) 
369 369
         {
370 370
             $args = $args[0];
371 371
         }
@@ -500,10 +500,10 @@  discard block
 block discarded – undo
500 500
     * @param mixed $default
501 501
     * @return mixed
502 502
     */
503
-    public function get($default=null)
503
+    public function get($default = null)
504 504
     {
505 505
         $value = $this->request->getParam($this->paramName);
506
-        if($value !== null && $value !== '') {
506
+        if ($value !== null && $value !== '') {
507 507
             return $value;
508 508
         }
509 509
 
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
     {
523 523
         $total = count($this->filters);
524 524
         for ($i = 0; $i < $total; $i++) {
525
-            $method = 'applyFilter_' . $this->filters[$i]['type'];
525
+            $method = 'applyFilter_'.$this->filters[$i]['type'];
526 526
             $value = $this->$method($value, $this->filters[$i]['params']);
527 527
         }
528 528
 
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
     * @param bool $stripEmptyEntries Remove empty entries from the array?
680 680
     * @return \AppUtils\Request_Param
681 681
     */
682
-    public function addCommaSeparatedFilter(bool $trimEntries=true, bool $stripEmptyEntries=true) : Request_Param
682
+    public function addCommaSeparatedFilter(bool $trimEntries = true, bool $stripEmptyEntries = true) : Request_Param
683 683
     {
684 684
         $this->setArray();
685 685
         
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
         );
693 693
     }
694 694
     
695
-    protected function addClassFilter(string $name, array $params=array()) : Request_Param
695
+    protected function addClassFilter(string $name, array $params = array()) : Request_Param
696 696
     {
697 697
         return $this->addFilter(
698 698
             self::FILTER_TYPE_CLASS,
Please login to merge, or discard this patch.
src/VariableInfo/Renderer/HTML.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
             str_replace(' ', '-', $this->type)
41 41
         );
42 42
         
43
-        if($this->info->getBoolOption('prepend-type') && !$this->info->isNull())
43
+        if ($this->info->getBoolOption('prepend-type') && !$this->info->isNull())
44 44
         {
45 45
             $typeLabel = '<span style="color:#1c2eb1" class="variable-type">'.$this->info->getType().'</span> ';
46 46
             $converted = $typeLabel.' '.$converted;
Please login to merge, or discard this patch.
src/VariableInfo/Renderer/String/Callable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
     {
11 11
         $string = '';
12 12
         
13
-        if(is_string($this->value[0])) 
13
+        if (is_string($this->value[0])) 
14 14
         {
15 15
             $string .= $this->value[0].'::';
16 16
         } 
Please login to merge, or discard this patch.
src/VariableInfo/Renderer/String/Array.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
     {
11 11
         $result = array();
12 12
         
13
-        foreach($this->value as $key => $val)
13
+        foreach ($this->value as $key => $val)
14 14
         {
15 15
             $result[$key] = parseVariable($val)->toString();
16 16
         }
Please login to merge, or discard this patch.
src/VariableInfo.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
     * @param mixed $value
39 39
     * @param array|null $serialized
40 40
     */
41
-    public function __construct($value, $serialized=null)
41
+    public function __construct($value, $serialized = null)
42 42
     {
43
-        if(is_array($serialized))
43
+        if (is_array($serialized))
44 44
         {
45 45
             $this->parseSerialized($serialized);
46 46
         }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         $this->value = $value;
89 89
         $this->type = strtolower(gettype($value));
90 90
         
91
-        if(is_array($value) && is_callable($value)) {
91
+        if (is_array($value) && is_callable($value)) {
92 92
             $this->type = self::TYPE_CALLABLE;
93 93
         }
94 94
         
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     * @param bool $enable
127 127
     * @return VariableInfo
128 128
     */
129
-    public function enableType(bool $enable=true) : VariableInfo
129
+    public function enableType(bool $enable = true) : VariableInfo
130 130
     {
131 131
         return $this->setOption('prepend-type', $enable);
132 132
     }
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
     {
136 136
         $converted = $this->string;
137 137
         
138
-        if($this->getOption('prepend-type') === true && !$this->isNull())
138
+        if ($this->getOption('prepend-type') === true && !$this->isNull())
139 139
         {
140
-            if($this->isString())
140
+            if ($this->isString())
141 141
             {
142 142
                 $converted = '"'.$converted.'"';
143 143
             }
Please login to merge, or discard this patch.
src/XMLHelper/Converter/Decorator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
     
108 108
     protected function detectAttributes()
109 109
     {
110
-        if(!$this->options['@attributes']) {
110
+        if (!$this->options['@attributes']) {
111 111
             return;
112 112
         }
113 113
         
114 114
         $attributes = $this->subject->attributes();
115 115
         
116
-        if(!empty($attributes)) 
116
+        if (!empty($attributes)) 
117 117
         {
118 118
             $this->result['@attributes'] = array_map('strval', iterator_to_array($attributes));
119 119
         }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $children = $this->subject;
125 125
         $depth = $this->options['depth'] - 1;
126 126
         
127
-        if($depth <= 0) 
127
+        if ($depth <= 0) 
128 128
         {
129 129
             $children = [];
130 130
         }
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
             
138 138
             $decorator->options = ['depth' => $depth] + $this->options;
139 139
             
140
-            if(isset($this->result[$name])) 
140
+            if (isset($this->result[$name])) 
141 141
             {
142
-                if(!is_array($this->result[$name])) 
142
+                if (!is_array($this->result[$name])) 
143 143
                 {
144 144
                     $this->result[$name] = [$this->result[$name]];
145 145
                 }
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
         // json encode non-whitespace element simplexml text values.
159 159
         $text = trim((string)$this->subject);
160 160
         
161
-        if(strlen($text)) 
161
+        if (strlen($text)) 
162 162
         {
163
-            if($this->options['@text']) 
163
+            if ($this->options['@text']) 
164 164
             {
165 165
                 $this->result['@text'] = $text;
166 166
             } 
Please login to merge, or discard this patch.
src/functions.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
  * @param mixed $value
17 17
  * @return \AppUtils\NumberInfo
18 18
  */
19
-function parseNumber($value, $forceNew=false)
19
+function parseNumber($value, $forceNew = false)
20 20
 {
21
-    if($value instanceof NumberInfo && $forceNew !== true) {
21
+    if ($value instanceof NumberInfo && $forceNew !== true) {
22 22
         return $value;
23 23
     }
24 24
     
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     $args = func_get_args();
100 100
     
101 101
     // is the localization package installed?
102
-    if(class_exists('\AppLocalize\Localization')) 
102
+    if (class_exists('\AppLocalize\Localization')) 
103 103
     {
104 104
         return call_user_func_array('\AppLocalize\t', $args);
105 105
     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
  */
118 118
 function requireCURL() : void
119 119
 {
120
-    if(function_exists('curl_init')) {
120
+    if (function_exists('curl_init')) {
121 121
         return;
122 122
     }
123 123
     
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
  */
136 136
 function init()
137 137
 {
138
-    if(!class_exists('\AppLocalize\Localization')) {
138
+    if (!class_exists('\AppLocalize\Localization')) {
139 139
         return;
140 140
     }
141 141
     
Please login to merge, or discard this patch.
src/URLInfo.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
     {
201 201
         $port = $this->getInfoKey('port');
202 202
         
203
-        if(!empty($port)) {
203
+        if (!empty($port)) {
204 204
             return (int)$port;
205 205
         }
206 206
         
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
     
281 281
     protected function getInfoKey(string $name) : string
282 282
     {
283
-        if(isset($this->info[$name])) {
283
+        if (isset($this->info[$name])) {
284 284
             return (string)$this->info[$name];
285 285
         }
286 286
         
@@ -289,11 +289,11 @@  discard block
 block discarded – undo
289 289
 
290 290
     public function getNormalized() : string
291 291
     {
292
-        if(!$this->isValid()) {
292
+        if (!$this->isValid()) {
293 293
             return '';
294 294
         }
295 295
         
296
-        if(!isset($this->normalizer)) {
296
+        if (!isset($this->normalizer)) {
297 297
             $this->normalizer = new URLInfo_Normalizer($this);
298 298
         }
299 299
         
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
     */
322 322
     public function getHighlighted() : string
323 323
     {
324
-        if(!$this->isValid()) {
324
+        if (!$this->isValid()) {
325 325
             return '';
326 326
         }
327 327
         
@@ -363,14 +363,14 @@  discard block
 block discarded – undo
363 363
     */
364 364
     public function getParams() : array
365 365
     {
366
-        if(!$this->paramExclusion || empty($this->excludedParams)) {
366
+        if (!$this->paramExclusion || empty($this->excludedParams)) {
367 367
             return $this->info['params'];
368 368
         }
369 369
         
370 370
         $keep = array();
371
-        foreach($this->info['params'] as $name => $value) 
371
+        foreach ($this->info['params'] as $name => $value) 
372 372
         {
373
-            if(!isset($this->excludedParams[$name])) {
373
+            if (!isset($this->excludedParams[$name])) {
374 374
                 $keep[$name] = $value;
375 375
             }
376 376
         }
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
     */
397 397
     public function getParam(string $name) : string
398 398
     {
399
-        if(isset($this->info['params'][$name])) {
399
+        if (isset($this->info['params'][$name])) {
400 400
             return $this->info['params'][$name];
401 401
         }
402 402
         
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
     */
416 416
     public function excludeParam(string $name, string $reason) : URLInfo
417 417
     {
418
-        if(!isset($this->excludedParams[$name]))
418
+        if (!isset($this->excludedParams[$name]))
419 419
         {
420 420
             $this->excludedParams[$name] = $reason;
421 421
             $this->setParamExclusion();
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
     
442 442
     public function getTypeLabel() : string
443 443
     {
444
-        if(!isset(self::$typeLabels))
444
+        if (!isset(self::$typeLabels))
445 445
         {
446 446
             self::$typeLabels = array(
447 447
                 self::TYPE_EMAIL => t('Email'),
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
         
454 454
         $type = $this->getType();
455 455
         
456
-        if(!isset(self::$typeLabels[$type]))
456
+        if (!isset(self::$typeLabels[$type]))
457 457
         {
458 458
             throw new BaseException(
459 459
                 sprintf('Unknown URL type label for type [%s].', $type),
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
     * @param bool $highlight
474 474
     * @return URLInfo
475 475
     */
476
-    public function setHighlightExcluded(bool $highlight=true) : URLInfo
476
+    public function setHighlightExcluded(bool $highlight = true) : URLInfo
477 477
     {
478 478
         $this->highlightExcluded = $highlight;
479 479
         return $this;
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
      * @see URLInfo::isParamExclusionEnabled()
522 522
      * @see URLInfo::setHighlightExcluded()
523 523
      */
524
-    public function setParamExclusion(bool $enabled=true) : URLInfo
524
+    public function setParamExclusion(bool $enabled = true) : URLInfo
525 525
     {
526 526
         $this->paramExclusion = $enabled;
527 527
         return $this;
@@ -547,13 +547,13 @@  discard block
 block discarded – undo
547 547
     */
548 548
     public function containsExcludedParams() : bool
549 549
     {
550
-        if(empty($this->excludedParams)) {
550
+        if (empty($this->excludedParams)) {
551 551
             return false;
552 552
         }
553 553
         
554 554
         $names = array_keys($this->info['params']);
555
-        foreach($names as $name) {
556
-            if(isset($this->excludedParams[$name])) {
555
+        foreach ($names as $name) {
556
+            if (isset($this->excludedParams[$name])) {
557 557
                 return true;
558 558
             }
559 559
         }
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 
570 570
     public function offsetSet($offset, $value) 
571 571
     {
572
-        if(in_array($offset, $this->infoKeys)) {
572
+        if (in_array($offset, $this->infoKeys)) {
573 573
             $this->info[$offset] = $value;
574 574
         }
575 575
     }
@@ -586,11 +586,11 @@  discard block
 block discarded – undo
586 586
     
587 587
     public function offsetGet($offset) 
588 588
     {
589
-        if($offset === 'port') {
589
+        if ($offset === 'port') {
590 590
             return $this->getPort();
591 591
         }
592 592
         
593
-        if(in_array($offset, $this->infoKeys)) {
593
+        if (in_array($offset, $this->infoKeys)) {
594 594
             return $this->getInfoKey($offset);
595 595
         }
596 596
         
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
         requireCURL();
628 628
         
629 629
         $ch = curl_init();
630
-        if($ch === false)
630
+        if ($ch === false)
631 631
         {
632 632
             throw new BaseException(
633 633
                 'Could not initialize a new cURL instance.',
Please login to merge, or discard this patch.