Passed
Push — master ( 3e8ce7...75b208 )
by Sebastian
08:39
created
src/IniHelper/Section.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
81 81
     {
82 82
         $result = array();
83 83
         
84
-        foreach($this->lines as $line)
84
+        foreach ($this->lines as $line)
85 85
         {
86
-            if(!$line->isValue()) {
86
+            if (!$line->isValue()) {
87 87
                 continue;
88 88
             }
89 89
 
90 90
             $name = $line->getVarName();
91 91
             
92
-            if(!isset($result[$name])) 
92
+            if (!isset($result[$name])) 
93 93
             {
94 94
                 $result[$name] = $line->getVarValue();
95 95
                 continue;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             // name exists in collection? Then this is a
99 99
             // duplicate key, and we need to convert it to
100 100
             // an indexed array of values.
101
-            if(!is_array($result[$name])) 
101
+            if (!is_array($result[$name])) 
102 102
             {
103 103
                 $result[$name] = array($result[$name]);
104 104
             }
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
     public function toString() : string
119 119
     {
120 120
         $lines = array();
121
-        if(!$this->isDefault()) 
121
+        if (!$this->isDefault()) 
122 122
         {
123 123
             $lines[] = '['.$this->getName().']';
124 124
         }
125 125
         
126
-        foreach($this->lines as $line) 
126
+        foreach ($this->lines as $line) 
127 127
         {
128 128
             // we already did this
129
-            if($line->isSection()) {
129
+            if ($line->isSection()) {
130 130
                 continue;
131 131
             }
132 132
             
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
     {
147 147
         $keep = array();
148 148
         
149
-        foreach($this->lines as $line)
149
+        foreach ($this->lines as $line)
150 150
         {
151
-            if($line !== $toDelete) {
151
+            if ($line !== $toDelete) {
152 152
                 $keep[] = $line;
153 153
             }
154 154
         }
@@ -174,23 +174,23 @@  discard block
 block discarded – undo
174 174
         // Removes any superfluous values that may
175 175
         // already exist, if there are more than the
176 176
         // new set of values.
177
-        if(is_array($value))
177
+        if (is_array($value))
178 178
         {
179 179
             $values = array_values($value);
180 180
             $amountNew = count($values);
181 181
             $amountExisting = count($lines);
182 182
             
183 183
             $max = $amountNew;
184
-            if($amountExisting > $max) {
184
+            if ($amountExisting > $max) {
185 185
                 $max = $amountExisting;
186 186
             }
187 187
             
188
-            for($i=0; $i < $max; $i++) 
188
+            for ($i = 0; $i < $max; $i++) 
189 189
             {
190 190
                 // new value exists
191
-                if(isset($values[$i]))
191
+                if (isset($values[$i]))
192 192
                 {
193
-                    if(isset($lines[$i])) {
193
+                    if (isset($lines[$i])) {
194 194
                         $lines[$i]->setValue($values[$i]);
195 195
                     } else {
196 196
                         $this->addValueLine($name, $values[$i]);
@@ -208,12 +208,12 @@  discard block
 block discarded – undo
208 208
         else
209 209
         {
210 210
             // remove all superfluous lines
211
-            if(!empty($lines))
211
+            if (!empty($lines))
212 212
             {
213 213
                 $line = array_shift($lines); // keep only the first line
214 214
                 $line->setValue($value);
215 215
                 
216
-                foreach($lines as $delete) {
216
+                foreach ($lines as $delete) {
217 217
                     $this->deleteLine($delete);
218 218
                 }
219 219
             }
@@ -238,11 +238,11 @@  discard block
 block discarded – undo
238 238
     public function addValue(string $name, $value) : IniHelper_Section
239 239
     {
240 240
         // array value? Treat it as duplicate keys.
241
-        if(is_array($value))
241
+        if (is_array($value))
242 242
         {
243 243
             $values = array_values($value);
244 244
             
245
-            foreach($values as $setValue)
245
+            foreach ($values as $setValue)
246 246
             {
247 247
                 $this->addValue($name, $setValue);
248 248
             }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         
253 253
         $lines = $this->getLinesByVariable($name);
254 254
         
255
-        if(empty($lines))
255
+        if (empty($lines))
256 256
         {
257 257
             $this->addValueLine($name, $value);
258 258
         }
@@ -260,15 +260,15 @@  discard block
 block discarded – undo
260 260
         {
261 261
             $found = false;
262 262
             
263
-            foreach($lines as $line)
263
+            foreach ($lines as $line)
264 264
             {
265
-                if($line->getVarValue() === $value) {
265
+                if ($line->getVarValue() === $value) {
266 266
                     $found = $line;
267 267
                     break;
268 268
                 }
269 269
             }
270 270
             
271
-            if(!$found)
271
+            if (!$found)
272 272
             {
273 273
                 $this->addValueLine($name, $value);
274 274
             }
@@ -307,9 +307,9 @@  discard block
 block discarded – undo
307 307
     {
308 308
         $result = array();
309 309
         
310
-        foreach($this->lines as $line)
310
+        foreach ($this->lines as $line)
311 311
         {
312
-            if($line->isValue() && $line->getVarName() === $name) {
312
+            if ($line->isValue() && $line->getVarName() === $name) {
313 313
                 $result[] = $line;
314 314
             }
315 315
         }
Please login to merge, or discard this patch.
src/IniHelper/INILine.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $this->trimmed = trim($text);
48 48
         $this->lineNumber = $lineNumber;
49 49
         
50
-        if(empty($this->trimmed)) 
50
+        if (empty($this->trimmed)) 
51 51
         {
52 52
             $this->type = self::TYPE_EMPTY;
53 53
             return;
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
         
56 56
         $startChar = $this->trimmed[0];
57 57
         
58
-        if($startChar === ';')
58
+        if ($startChar === ';')
59 59
         {
60 60
             $this->type = self::TYPE_COMMENT;
61 61
         }
62
-        else if($startChar === '[')
62
+        else if ($startChar === '[')
63 63
         {
64 64
             $this->type = self::TYPE_SECTION_DECLARATION;
65 65
             $this->sectionName = trim($this->trimmed, '[]');
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         else
69 69
         {
70 70
             $pos = strpos($this->trimmed, '=');
71
-            if($pos === false) 
71
+            if ($pos === false) 
72 72
             {
73 73
                 $this->type = self::TYPE_INVALID;
74 74
                 return;
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             $this->type = self::TYPE_VALUE;
78 78
             $this->varName = trim(substr($this->trimmed, 0, $pos));
79 79
             
80
-            $this->parseValue(substr($this->trimmed, $pos+1));
80
+            $this->parseValue(substr($this->trimmed, $pos + 1));
81 81
         }
82 82
     }
83 83
     
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
         $this->varValue = trim($value);
87 87
         $value = $this->varValue;
88 88
 
89
-        if(empty($value)) {
89
+        if (empty($value)) {
90 90
             return;
91 91
         }
92 92
         
93
-        if($value[0] === '"' && $value[strlen($value) - 1] === '"')
93
+        if ($value[0] === '"' && $value[strlen($value) - 1] === '"')
94 94
         {
95 95
             $value = trim($value, '"');
96 96
             $this->quoteStyle = '"';
97 97
         }
98
-        else if($value[0] === "'" && $value[strlen($value) - 1] === "'")
98
+        else if ($value[0] === "'" && $value[strlen($value) - 1] === "'")
99 99
         {
100 100
             $value = trim($value, "'");
101 101
             $this->quoteStyle = "'";
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     
117 117
     public function getQuotedVarValue() : string
118 118
     {
119
-        if($this->quoteStyle === '') {
119
+        if ($this->quoteStyle === '') {
120 120
             return $this->getVarValue();
121 121
         }
122 122
         
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      */
176 176
     public function setValue($value) : INILine
177 177
     {
178
-        if(!is_null($value) && !is_scalar($value))
178
+        if (!is_null($value) && !is_scalar($value))
179 179
         {
180 180
             throw new IniHelper_Exception(
181 181
                 'Cannot use non-scalar values.',
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
     
196 196
     public function toString() : string
197 197
     {
198
-        switch($this->type) 
198
+        switch ($this->type) 
199 199
         {
200 200
             case self::TYPE_EMPTY:
201 201
             case self::TYPE_INVALID:
Please login to merge, or discard this patch.
src/Request/Param/Filter/String.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
     
21 21
     protected function _filter() : string
22 22
     {
23
-        if(!is_scalar($this->value)) {
23
+        if (!is_scalar($this->value)) {
24 24
             return '';
25 25
         }
26 26
         
Please login to merge, or discard this patch.
src/Request/Param/Filter/CommaSeparated.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
      */
27 27
     protected function _filter() : array
28 28
     {
29
-        if(is_array($this->value)) {
29
+        if (is_array($this->value)) {
30 30
             return $this->value;
31 31
         }
32 32
         
33
-        if($this->value === '' || !is_string($this->value)) {
33
+        if ($this->value === '' || !is_string($this->value)) {
34 34
             return array();
35 35
         }
36 36
         
@@ -38,19 +38,19 @@  discard block
 block discarded – undo
38 38
         $stripEmptyEntries = $this->getBoolOption('stripEmptyEntries');
39 39
         $result = explode(',', $this->value);
40 40
         
41
-        if(!$trimEntries && !$stripEmptyEntries) {
41
+        if (!$trimEntries && !$stripEmptyEntries) {
42 42
             return $result;
43 43
         }
44 44
         
45 45
         $keep = array();
46 46
         
47
-        foreach($result as $entry)
47
+        foreach ($result as $entry)
48 48
         {
49
-            if($trimEntries === true) {
49
+            if ($trimEntries === true) {
50 50
                 $entry = trim($entry);
51 51
             }
52 52
             
53
-            if($stripEmptyEntries === true && $entry === '') {
53
+            if ($stripEmptyEntries === true && $entry === '') {
54 54
                 continue;
55 55
             }
56 56
             
Please login to merge, or discard this patch.
src/Request/Param/Validator/Enum.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
      */
33 33
     protected function _validate()
34 34
     {
35
-        if(in_array($this->value, $this->getArrayOption('values'), true)) {
35
+        if (in_array($this->value, $this->getArrayOption('values'), true)) {
36 36
             return $this->value;
37 37
         }
38 38
         
Please login to merge, or discard this patch.
src/Request/Param/Validator/Integer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
     
31 31
     protected function _validate() : ?int
32 32
     {
33
-        if(ConvertHelper::isInteger($this->value)) {
33
+        if (ConvertHelper::isInteger($this->value)) {
34 34
             return (int)$this->value;
35 35
         }
36 36
         
Please login to merge, or discard this patch.
src/Request/Param/Validator/Alpha.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@
 block discarded – undo
27 27
     
28 28
     protected function _validate() : ?string
29 29
     {
30
-        if(!is_scalar($this->value)) {
30
+        if (!is_scalar($this->value)) {
31 31
             return null;
32 32
         }
33 33
 
34 34
         $value = (string)$this->value;
35 35
         
36
-        if(preg_match('/\A[a-zA-Z]+\z/', $value)) {
36
+        if (preg_match('/\A[a-zA-Z]+\z/', $value)) {
37 37
             return $value;
38 38
         }
39 39
         
Please login to merge, or discard this patch.
src/Request/Param/Validator/Valueslist.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,22 +36,22 @@
 block discarded – undo
36 36
         
37 37
         // if we are validating a subvalue, it means we are 
38 38
         // validating a single value in the existing list.
39
-        if($this->isSubvalue) 
39
+        if ($this->isSubvalue) 
40 40
         {
41
-            if(in_array($this->value, $allowed, true)) {
41
+            if (in_array($this->value, $allowed, true)) {
42 42
                 return $this->value;
43 43
             }
44 44
             
45 45
             return null;
46 46
         }
47 47
         
48
-        if(!is_array($this->value)) {
48
+        if (!is_array($this->value)) {
49 49
             return array();
50 50
         }
51 51
         
52 52
         $keep = array();
53
-        foreach($this->value as $item) {
54
-            if(in_array($item, $allowed, true)) {
53
+        foreach ($this->value as $item) {
54
+            if (in_array($item, $allowed, true)) {
55 55
                 $keep[] = $item;
56 56
             }
57 57
         }
Please login to merge, or discard this patch.
src/Request/Param/Validator/Regex.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     
28 28
     protected function _validate() : ?string
29 29
     {
30
-        if(!is_scalar($this->value)) {
30
+        if (!is_scalar($this->value)) {
31 31
             return null;
32 32
         }
33 33
         
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
         // is a boolean, which is converted to an integer when
36 36
         // converted to string, which in turn can be validated
37 37
         // with a regex.
38
-        if(is_bool($this->value)) {
38
+        if (is_bool($this->value)) {
39 39
             return null;
40 40
         }
41 41
         
42 42
         $value = (string)$this->value;
43 43
         
44
-        if(preg_match($this->getStringOption('regex'), $value)) {
44
+        if (preg_match($this->getStringOption('regex'), $value)) {
45 45
             return $value;
46 46
         }
47 47
         
Please login to merge, or discard this patch.