@@ -5,9 +5,9 @@ discard block |
||
5 | 5 | { |
6 | 6 | private $rules; |
7 | 7 | |
8 | - public function __construct($rules = []) |
|
8 | + public function __construct($rules = [ ]) |
|
9 | 9 | { |
10 | - $this->rules = []; |
|
10 | + $this->rules = [ ]; |
|
11 | 11 | $this->addRules($rules); |
12 | 12 | } |
13 | 13 | |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | { |
19 | 19 | foreach ($rules as $rule) { |
20 | 20 | try { |
21 | - $this->rules[] = new AdblockRule($rule); |
|
21 | + $this->rules[ ] = new AdblockRule($rule); |
|
22 | 22 | } catch (InvalidRuleException $e) { |
23 | 23 | } |
24 | 24 | } |
25 | 25 | |
26 | 26 | // Sort rules, eceptions first |
27 | - usort($this->rules, function ($a, $b) { |
|
28 | - return (int)$a->isException() < (int)$b->isException(); |
|
27 | + usort($this->rules, function($a, $b) { |
|
28 | + return (int) $a->isException() < (int) $b->isException(); |
|
29 | 29 | }); |
30 | 30 | } |
31 | 31 |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function matchUrl($url) |
45 | 45 | { |
46 | - return (boolean)preg_match( |
|
47 | - '/' . $this->getRegex() . '/', |
|
46 | + return (boolean) preg_match( |
|
47 | + '/'.$this->getRegex().'/', |
|
48 | 48 | $url |
49 | 49 | ); |
50 | 50 | } |
@@ -113,18 +113,18 @@ discard block |
||
113 | 113 | |
114 | 114 | // | in the end means the end of the address |
115 | 115 | if ($this->endsWith($regex, '|')) { |
116 | - $regex = mb_substr($regex, 0, mb_strlen($regex) - 1) . '$'; |
|
116 | + $regex = mb_substr($regex, 0, mb_strlen($regex) - 1).'$'; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | // || in the beginning means beginning of the domain name |
120 | 120 | if ($this->startsWith($regex, '||')) { |
121 | 121 | if (mb_strlen($regex) > 2) { |
122 | 122 | // http://tools.ietf.org/html/rfc3986#appendix-B |
123 | - $regex = "^([^:\/?#]+:)?(\/\/([^\/?#]*\.)?)?" . mb_substr($regex, 2); |
|
123 | + $regex = "^([^:\/?#]+:)?(\/\/([^\/?#]*\.)?)?".mb_substr($regex, 2); |
|
124 | 124 | } |
125 | 125 | // | in the beginning means start of the address |
126 | 126 | } elseif ($this->startsWith($regex, '|')) { |
127 | - $regex = '^' . mb_substr($regex, 1); |
|
127 | + $regex = '^'.mb_substr($regex, 1); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | // other | symbols should be escaped |