Test Failed
Pull Request — master (#7)
by
unknown
08:47
created
src/AdblockParser.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
     private $cacheExpire = 1; // 1 day
14 14
 
15
-    public function __construct(array $rules = [])
15
+    public function __construct(array $rules = [ ])
16 16
     {
17 17
         $this->initRules($rules);
18 18
     }
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
     /**
21 21
      * @param array $rules
22 22
      */
23
-    public function initRules(array $rules = [])
23
+    public function initRules(array $rules = [ ])
24 24
     {
25
-        $this->rules = [];
25
+        $this->rules = [ ];
26 26
         $this->addRules($rules);
27 27
     }
28 28
 
@@ -33,15 +33,15 @@  discard block
 block discarded – undo
33 33
     {
34 34
         foreach ($rules as $rule) {
35 35
             try {
36
-                $this->rules[] = new AdblockRule($rule);
36
+                $this->rules[ ] = new AdblockRule($rule);
37 37
             } catch (InvalidRuleException $e) {
38 38
                 // Skip invalid rules
39 39
             }
40 40
         }
41 41
 
42 42
         // Sort rules, exceptions first
43
-        usort($this->rules, function (AdblockRule $a, AdblockRule $b) {
44
-            return (int)$a->isException() < (int)$b->isException();
43
+        usort($this->rules, function(AdblockRule $a, AdblockRule $b) {
44
+            return (int) $a->isException() < (int) $b->isException();
45 45
         });
46 46
     }
47 47
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function shouldBlock($url)
86 86
     {
87
-        $rules = [];
87
+        $rules = [ ];
88 88
         $url = trim($url);
89 89
 
90 90
         if (filter_var($url, FILTER_VALIDATE_URL) === false) {
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             }
98 98
 
99 99
             if ($rule->matchUrl($url)) {
100
-                $rules[] = $rule->getRule();
100
+                $rules[ ] = $rule->getRule();
101 101
             }
102 102
         }
103 103
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      */
132 132
     public function setCacheFolder($cacheFolder)
133 133
     {
134
-        $this->cacheFolder = rtrim($cacheFolder, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
134
+        $this->cacheFolder = rtrim($cacheFolder, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
135 135
     }
136 136
 
137 137
     /**
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     public function clearCache()
161 161
     {
162 162
         if ($this->cacheFolder) {
163
-            foreach (glob($this->cacheFolder . '*') as $file) {
163
+            foreach (glob($this->cacheFolder.'*') as $file) {
164 164
                 unlink($file);
165 165
             }
166 166
         }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             return @file_get_contents($url);
178 178
         }
179 179
 
180
-        $cacheFile = $this->cacheFolder . basename($url) . md5($url);
180
+        $cacheFile = $this->cacheFolder.basename($url).md5($url);
181 181
 
182 182
         if (file_exists($cacheFile) && (filemtime($cacheFile) > (time() - 60 * 24 * $this->cacheExpire))) {
183 183
             // Cache file is less than five minutes old.
Please login to merge, or discard this patch.
src/AdblockRule.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     public function matchUrl($url)
73 73
     {
74 74
         try {
75
-            return (boolean)preg_match('/' . $this->getRegex() . '/', $url);
75
+            return (boolean) preg_match('/'.$this->getRegex().'/', $url);
76 76
         } catch (\Exception $e) {
77 77
             throw  new \Exception($e);
78 78
         }
@@ -143,18 +143,18 @@  discard block
 block discarded – undo
143 143
 
144 144
         // | in the end means the end of the address
145 145
         if (Str::endsWith($regex, '|')) {
146
-            $regex = mb_substr($regex, 0, mb_strlen($regex) - 1) . '$';
146
+            $regex = mb_substr($regex, 0, mb_strlen($regex) - 1).'$';
147 147
         }
148 148
 
149 149
         // || in the beginning means beginning of the domain name
150 150
         if (Str::startsWith($regex, '||')) {
151 151
             if (mb_strlen($regex) > 2) {
152 152
                 // http://tools.ietf.org/html/rfc3986#appendix-B
153
-                $regex = "^([^:\/?#]+:)?(\/\/([^\/?#]*\.)?)?" . mb_substr($regex, 2);
153
+                $regex = "^([^:\/?#]+:)?(\/\/([^\/?#]*\.)?)?".mb_substr($regex, 2);
154 154
             }
155 155
         // | in the beginning means start of the address
156 156
         } elseif (Str::startsWith($regex, '|')) {
157
-            $regex = '^' . mb_substr($regex, 1);
157
+            $regex = '^'.mb_substr($regex, 1);
158 158
         }
159 159
 
160 160
         // other | symbols should be escaped
Please login to merge, or discard this patch.