1 | <?php |
||
4 | class AdblockParser |
||
5 | { |
||
6 | private $rules; |
||
7 | |||
8 | private $cacheExpire = 1; // 1 day |
||
9 | |||
10 | const CACHE_FOLDER = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR; |
||
11 | |||
12 | 10 | public function __construct($rules = []) |
|
17 | |||
18 | /** |
||
19 | * @param string[] $rules |
||
20 | */ |
||
21 | 10 | public function addRules($rules) |
|
36 | |||
37 | /** |
||
38 | * @param string|array $path |
||
39 | */ |
||
40 | 3 | public function loadRules($path) |
|
60 | |||
61 | /** |
||
62 | * @return array |
||
63 | */ |
||
64 | 1 | public function getRules() |
|
68 | |||
69 | /** |
||
70 | * @param string $url |
||
71 | * |
||
72 | * @return integer |
||
73 | */ |
||
74 | 10 | public function shouldBlock($url) |
|
97 | |||
98 | /** |
||
99 | * @param string $url |
||
100 | * |
||
101 | * @return boolean |
||
102 | */ |
||
103 | 7 | public function shouldNotBlock($url) |
|
107 | |||
108 | /** |
||
109 | * Get external resources cache expire (in days) |
||
110 | * |
||
111 | * @return integer |
||
112 | */ |
||
113 | 1 | public function getCacheExpire() |
|
117 | |||
118 | /** |
||
119 | * Set external resources cache expire (in days) |
||
120 | * |
||
121 | * @param integer $expire |
||
|
|||
122 | */ |
||
123 | public function setCacheExpire($expireInDays) |
||
127 | |||
128 | /** |
||
129 | * Clear external resources cache |
||
130 | */ |
||
131 | 1 | public function clearCache() |
|
137 | |||
138 | /** |
||
139 | * @param string $url |
||
140 | * |
||
141 | * @return string |
||
142 | */ |
||
143 | 2 | private function getCachedResource($url) |
|
160 | } |
||
161 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.
Consider the following example. The parameter
$ireland
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was changed, but the annotation was not.