Test Failed
Branch master (20b14b)
by Marcio
04:20
created
src/Ballybran/Helpers/Security/Val.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
 
45 45
     public function digit(string $data)
46 46
     {
47
-        if ( false == ctype_digit($data) ) {
47
+        if (false == ctype_digit($data)) {
48 48
             return "Your string " . $data . " must be a digit";
49 49
         }
50 50
     }
Please login to merge, or discard this patch.
src/Ballybran/Helpers/Security/Validate.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     public function text()
152 152
     {
153 153
         if (!is_string($this->_postData[$this->_currentItem])) {
154
-            throw new \InvalidArgumentException('the value ('.$this->_postData[$this->_currentItem].') entered must have a Text');
154
+            throw new \InvalidArgumentException('the value (' . $this->_postData[$this->_currentItem] . ') entered must have a Text');
155 155
         }
156 156
 
157 157
         return $this;
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     {
162 162
         $email = filter_var($this->_postData[$this->_currentItem], FILTER_SANITIZE_EMAIL);
163 163
         if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
164
-            throw new \InvalidArgumentException('the value ('.$this->_postData[$this->_currentItem].') entered must have a Email');
164
+            throw new \InvalidArgumentException('the value (' . $this->_postData[$this->_currentItem] . ') entered must have a Email');
165 165
         }
166 166
 
167 167
         return $this;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     public function numeric()
171 171
     {
172 172
         if (!is_numeric($this->_postData[$this->_currentItem])) {
173
-            throw new \InvalidArgumentException('the value ('.$this->_postData[$this->_currentItem].') entered must have a Numeric');
173
+            throw new \InvalidArgumentException('the value (' . $this->_postData[$this->_currentItem] . ') entered must have a Numeric');
174 174
         }
175 175
 
176 176
         return $this;
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     public function int()
180 180
     {
181 181
         if (!intval($this->_postData[$this->_currentItem])) {
182
-            throw new \InvalidArgumentException('the value ('.$this->_postData[$this->_currentItem].') entered must have a Int');
182
+            throw new \InvalidArgumentException('the value (' . $this->_postData[$this->_currentItem] . ') entered must have a Int');
183 183
         }
184 184
 
185 185
         return $this;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
     public function long()
189 189
     {
190 190
         if (!floatval($this->_postData[$this->_currentItem])) {
191
-            throw new \InvalidArgumentException('the value ('.$this->_postData[$this->_currentItem].') entered must have a Long');
191
+            throw new \InvalidArgumentException('the value (' . $this->_postData[$this->_currentItem] . ') entered must have a Long');
192 192
         }
193 193
 
194 194
         return $this;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     public function domain()
198 198
     {
199 199
         if (!filter_var($this->_postData[$this->_currentItem], FILTER_VALIDATE_DOMAIN)) {
200
-            throw new \InvalidArgumentException('the value ('.$this->_postData[$this->_currentItem].') entered must have a Domain');
200
+            throw new \InvalidArgumentException('the value (' . $this->_postData[$this->_currentItem] . ') entered must have a Domain');
201 201
         }
202 202
 
203 203
         return $this;
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     public function url()
207 207
     {
208 208
         if (!filter_var($this->_postData[$this->_currentItem], FILTER_VALIDATE_URL)) {
209
-            throw new \InvalidArgumentException('the value ('.$this->_postData[$this->_currentItem].') entered must have a Url');
209
+            throw new \InvalidArgumentException('the value (' . $this->_postData[$this->_currentItem] . ') entered must have a Url');
210 210
         }
211 211
 
212 212
         return $this;
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     public function ip()
216 216
     {
217 217
         if (!filter_var($this->_postData[$this->_currentItem], FILTER_VALIDATE_IP)) {
218
-            throw new \InvalidArgumentException('the value ('.$this->_postData[$this->_currentItem].') entered must have a Ip');
218
+            throw new \InvalidArgumentException('the value (' . $this->_postData[$this->_currentItem] . ') entered must have a Ip');
219 219
         }
220 220
 
221 221
         return $this;
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
     public function date()
225 225
     {
226 226
         if (!is_string($this->_postData[$this->_currentItem])) {
227
-            throw new \InvalidArgumentException('the value ('.$this->_postData[$this->_currentItem].') entered must have a Date');
227
+            throw new \InvalidArgumentException('the value (' . $this->_postData[$this->_currentItem] . ') entered must have a Date');
228 228
         }
229 229
 
230 230
         return $this;
Please login to merge, or discard this patch.
src/Ballybran/Helpers/Log/StdoutLogger.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@
 block discarded – undo
26 26
     /**
27 27
      * @param string $message
28 28
      */
29
-    public function write( $message, string $type = null)
29
+    public function write($message, string $type = null)
30 30
     {
31
-        return $this->message =$message;
31
+        return $this->message = $message;
32 32
     }
33 33
 }
Please login to merge, or discard this patch.
src/Ballybran/Helpers/Log/FileLoggerFactory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 namespace Ballybran\Helpers\Log;
19 19
 
20 20
 
21
-class FileLoggerFactory implements iLoggerFactory{
21
+class FileLoggerFactory implements iLoggerFactory {
22 22
 
23 23
     /**
24 24
      * @var string
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     private $filePath;
27 27
     private $dir;
28 28
 
29
-    public function __construct(string $filePath, $dir= null)
29
+    public function __construct(string $filePath, $dir = null)
30 30
     {
31 31
         if ($dir != null) {
32 32
 
Please login to merge, or discard this patch.
src/Ballybran/Helpers/Log/iLogger.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 namespace Ballybran\Helpers\Log;
20 20
 
21 21
 
22
-interface iLogger{
22
+interface iLogger {
23 23
 
24
-    public function write( $message, string $type = null);
24
+    public function write($message, string $type = null);
25 25
 }
Please login to merge, or discard this patch.
src/Ballybran/Helpers/Log/StdoutLoggerFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
 namespace Ballybran\Helpers\Log;
20 20
 
21
-class StdoutLoggerFactory implements iLoggerFactory{
21
+class StdoutLoggerFactory implements iLoggerFactory {
22 22
 
23 23
 
24 24
     public function createLogger(): iLogger
Please login to merge, or discard this patch.
src/Ballybran/Helpers/Firewall/Firewall.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -169,15 +169,15 @@  discard block
 block discarded – undo
169 169
     public function ipToHex($ipAddress)
170 170
     {
171 171
         $hex = '';
172
-        if ( false !== strpos($ipAddress, ',') ) {
172
+        if (false !== strpos($ipAddress, ',')) {
173 173
             $splitIp = explode(',', $ipAddress);
174 174
             $ipAddress = trim($splitIp[0]);
175 175
         }
176 176
         $isIpV6 = false;
177 177
         $isIpV4 = false;
178
-        if ( false !== filter_var($ipAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) ) {
178
+        if (false !== filter_var($ipAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
179 179
             $isIpV6 = true;
180
-        } else if (false !== filter_var($ipAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) ) {
180
+        } else if (false !== filter_var($ipAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
181 181
             $isIpV4 = true;
182 182
         }
183 183
         if (!$isIpV4 && !$isIpV6) {
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         else {
196 196
             $parts = explode(':', $ipAddress);
197 197
             // If this is mixed IPv6/IPv4, convert end to IPv6 value
198
-            if ( false !== filter_var($parts[count($parts) - 1], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) ) {
198
+            if (false !== filter_var($parts[count($parts) - 1], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
199 199
                 $partsV4 = explode('.', $parts[count($parts) - 1]);
200 200
                 for ($i = 0; $i < 4; $i++) {
201 201
                     $partsV4[$i] = str_pad(dechex($partsV4[$i]), 2, '0', STR_PAD_LEFT);
Please login to merge, or discard this patch.
Braces   +19 added lines, -7 removed lines patch added patch discarded remove patch
@@ -240,11 +240,18 @@  discard block
 block discarded – undo
240 240
         $QRange1 = $temp[0];
241 241
         $QRange2 = $temp[1];
242 242
 
243
-        if ($QRange2 == "") return array($QRange1); //special case, they didn't put a second quad parameter
243
+        if ($QRange2 == "") {
244
+            return array($QRange1);
245
+        }
246
+        //special case, they didn't put a second quad parameter
244 247
 
245 248
         //basic error handling to see if it is generally a valid IP in the form N.N.N.N
246
-        if (preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $QRange1) != 1) return array(-1);
247
-        if (preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $QRange2) != 1) return array(-1);
249
+        if (preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $QRange1) != 1) {
250
+            return array(-1);
251
+        }
252
+        if (preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $QRange2) != 1) {
253
+            return array(-1);
254
+        }
248 255
 
249 256
         $quad1 = explode(".", $QRange1);
250 257
         $quad2 = explode(".", $QRange2);
@@ -252,12 +259,16 @@  discard block
 block discarded – undo
252 259
         reset($quad1);
253 260
         while (list ($key, $val) = each($quad1)) {
254 261
             $quad1[$key] = intval($val);
255
-            if ($quad1[$key] < 0 || $quad1[$key] > 255) return array(-2);
262
+            if ($quad1[$key] < 0 || $quad1[$key] > 255) {
263
+                return array(-2);
264
+            }
256 265
         }
257 266
         reset($quad2);
258 267
         while (list ($key, $val) = each($quad2)) {
259 268
             $quad2[$key] = intval($val);
260
-            if ($quad2[$key] < 0 || $quad2[$key] > 255) return array(-2);
269
+            if ($quad2[$key] < 0 || $quad2[$key] > 255) {
270
+                return array(-2);
271
+            }
261 272
         }
262 273
 
263 274
         $startIP_long = sprintf("%u", ip2long($QRange1));
@@ -272,8 +283,9 @@  discard block
 block discarded – undo
272 283
 
273 284
             //this is a total hack. there must be a better way.
274 285
             $thisQuad = explode(".", $temp);
275
-            if ($thisQuad[3] > 0 && $thisQuad[3] < 255)
276
-                $ip[$k++] = $temp;
286
+            if ($thisQuad[3] > 0 && $thisQuad[3] < 255) {
287
+                            $ip[$k++] = $temp;
288
+            }
277 289
         }
278 290
 
279 291
         return $ip;
Please login to merge, or discard this patch.
src/Ballybran/Helpers/Http/Client/ClientRest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         curl_setopt($curl, CURLOPT_POST, true);
86 86
         curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data);
87 87
         $curl_response = curl_exec($curl);
88
-        if ( false === $curl_response ) {
88
+        if (false === $curl_response) {
89 89
             $info = curl_getinfo($curl);
90 90
             curl_close($curl);
91 91
             die('error occured during curl exec. Additioanl info: ' . var_export($info));
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         $data = array("status" => 'R');
108 108
         curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
109 109
         $response = curl_exec($ch);
110
-        if ( false === $response ) {
110
+        if (false === $response) {
111 111
             $info = curl_getinfo($ch);
112 112
             curl_close($ch);
113 113
             die('error occured during curl exec. Additioanl info: ' . var_export($info));
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         );
136 136
         curl_setopt($ch, CURLOPT_POSTFIELDS, $curl_post_data);
137 137
         $curl_response = curl_exec($ch);
138
-        if ( false === $curl_response ) {
138
+        if (false === $curl_response) {
139 139
             $info = curl_getinfo($ch);
140 140
             curl_close($ch);
141 141
             die('error occured during curl exec. Additioanl info: ' . var_export($info));
Please login to merge, or discard this patch.
src/Ballybran/Helpers/Http/Cookie.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -257,7 +257,7 @@
 block discarded – undo
257 257
     }
258 258
 
259 259
     public function setValue($value){
260
-         $this->data['value']= $value;
260
+            $this->data['value']= $value;
261 261
 
262 262
     }
263 263
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      *
59 59
      * @return Cookie
60 60
      */
61
-    public function createCookie( $name, int $maxage = 0, string $path = '', string $domain = '', bool $secure = false,bool $HTTPOnly = false): Cookie
61
+    public function createCookie($name, int $maxage = 0, string $path = '', string $domain = '', bool $secure = false, bool $HTTPOnly = false): Cookie
62 62
     {
63 63
         $this->setName($name)
64 64
         ->setMaxage($maxage)
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         $ob = ini_get('output_buffering');
76 76
 
77 77
         // Abort the method if headers have already been sent, except when output buffering has been enabled
78
-        if (headers_sent() && false === (bool)$ob  || 'off' == strtolower($ob) ) {
78
+        if (headers_sent() && false === (bool)$ob || 'off' == strtolower($ob)) {
79 79
             return $this;
80 80
         }
81 81
 
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public function setName($name) : Cookie
131 131
     {
132
-        if(is_array($name)) {
132
+        if (is_array($name)) {
133 133
 
134 134
             foreach ($name as $k => $v) {
135 135
                 $this->data['name'] = $k . '=' . rawurlencode($v);
136 136
             }
137
-        }else {
138
-            $this->data['name'] = $name . '='. rawurlencode($name);
137
+        } else {
138
+            $this->data['name'] = $name . '=' . rawurlencode($name);
139 139
         }
140 140
 
141 141
         return $this;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
             }
189 189
             // Remove port information.
190 190
             $port = strpos($domain, ':');
191
-            if ( false !== $port ) {
191
+            if (false !== $port) {
192 192
                 $this->data['domain'] = substr($domain, 0, $port);
193 193
             }
194 194
         }
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
         return $this->data['value'];
257 257
     }
258 258
 
259
-    public function setValue($value){
260
-         $this->data['value']= $value;
259
+    public function setValue($value) {
260
+         $this->data['value'] = $value;
261 261
 
262 262
     }
263 263
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@
 block discarded – undo
134 134
             foreach ($name as $k => $v) {
135 135
                 $this->data['name'] = $k . '=' . rawurlencode($v);
136 136
             }
137
-        }else {
137
+        } else {
138 138
             $this->data['name'] = $name . '='. rawurlencode($name);
139 139
         }
140 140
 
Please login to merge, or discard this patch.