@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | |
10 | 10 | private $cacheExpire = 1; // 1 day |
11 | 11 | |
12 | - public function __construct($rules = []) |
|
12 | + public function __construct($rules = [ ]) |
|
13 | 13 | { |
14 | - $this->rules = []; |
|
14 | + $this->rules = [ ]; |
|
15 | 15 | $this->addRules($rules); |
16 | 16 | } |
17 | 17 | |
@@ -22,15 +22,15 @@ discard block |
||
22 | 22 | { |
23 | 23 | foreach ($rules as $rule) { |
24 | 24 | try { |
25 | - $this->rules[] = new AdblockRule($rule); |
|
25 | + $this->rules[ ] = new AdblockRule($rule); |
|
26 | 26 | } catch (InvalidRuleException $e) { |
27 | 27 | // Skip invalid rules |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | 31 | // Sort rules, eceptions first |
32 | - usort($this->rules, function ($a, $b) { |
|
33 | - return (int)$a->isException() < (int)$b->isException(); |
|
32 | + usort($this->rules, function($a, $b) { |
|
33 | + return (int) $a->isException() < (int) $b->isException(); |
|
34 | 34 | }); |
35 | 35 | } |
36 | 36 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function setCacheFolder($cacheFolder) |
124 | 124 | { |
125 | - $this->cacheFolder = rtrim($cacheFolder, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
|
125 | + $this->cacheFolder = rtrim($cacheFolder, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | public function clearCache() |
152 | 152 | { |
153 | 153 | if ($this->cacheFolder) { |
154 | - foreach (glob($this->cacheFolder . '*') as $file) { |
|
154 | + foreach (glob($this->cacheFolder.'*') as $file) { |
|
155 | 155 | unlink($file); |
156 | 156 | } |
157 | 157 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | return @file_get_contents($url); |
169 | 169 | } |
170 | 170 | |
171 | - $cacheFile = $this->cacheFolder . basename($url) . md5($url); |
|
171 | + $cacheFile = $this->cacheFolder.basename($url).md5($url); |
|
172 | 172 | |
173 | 173 | if (file_exists($cacheFile) && (filemtime($cacheFile) > (time() - 60 * 24 * $this->cacheExpire))) { |
174 | 174 | // Cache file is less than five minutes old. |