1 | <?php |
||
14 | class Rules implements \Countable |
||
15 | { |
||
16 | const DEFAULT_UA = '*'; |
||
17 | |||
18 | /** |
||
19 | * The collection of rules |
||
20 | * @var array |
||
21 | */ |
||
22 | protected $collection = []; |
||
23 | |||
24 | /** |
||
25 | * Default rule used if robots.txt is empty |
||
26 | * @var Rule |
||
27 | */ |
||
28 | private $defaultRule; |
||
29 | |||
30 | public function __construct() |
||
35 | |||
36 | /** |
||
37 | * Add a new rule to the collection |
||
38 | * @param string $userAgent |
||
|
|||
39 | * @param Rule $rule |
||
40 | * @return Rules |
||
41 | */ |
||
42 | public function add(Rule $rule) |
||
56 | |||
57 | /** |
||
58 | * Check if the URL match for the given UA or not |
||
59 | * @param string $userAgent |
||
60 | * @param string $url |
||
61 | * @return boolean |
||
62 | */ |
||
63 | public function match($userAgent, $url) |
||
67 | |||
68 | /** |
||
69 | * Retrieve rules for a given UA |
||
70 | * @param string $userAgent |
||
71 | * @return null|Rule |
||
72 | */ |
||
73 | public function get($userAgent) |
||
94 | |||
95 | /** |
||
96 | * Update the UA to make a valid regexp |
||
97 | * @param string $userAgent |
||
98 | * @return string |
||
99 | */ |
||
100 | private function handleUa($userAgent) |
||
107 | |||
108 | /** |
||
109 | * Return the number of rules |
||
110 | * @return integer |
||
111 | */ |
||
112 | public function count() |
||
116 | } |
||
117 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.