1 | <?php |
||
9 | class Parser implements RobotsTxtInterface |
||
10 | { |
||
11 | use ObjectTools; |
||
12 | |||
13 | const SUB_DIRECTIVES = [ |
||
14 | self::DIRECTIVE_CLEAN_PARAM, |
||
15 | self::DIRECTIVE_HOST, |
||
16 | self::DIRECTIVE_SITEMAP, |
||
17 | self::DIRECTIVE_USER_AGENT, |
||
18 | ]; |
||
19 | |||
20 | protected $raw; |
||
21 | |||
22 | protected $cleanParam; |
||
23 | protected $host; |
||
24 | protected $sitemap; |
||
25 | protected $userAgent; |
||
26 | |||
27 | /** |
||
28 | * Constructor |
||
29 | * |
||
30 | * @param string $content - file content |
||
31 | * @param string $encoding - character encoding |
||
32 | * @param integer|null $byteLimit - maximum of bytes to parse |
||
33 | * @throws Exceptions\ParserException |
||
34 | */ |
||
35 | public function __construct($content, $encoding = self::ENCODING, $byteLimit = self::BYTE_LIMIT) |
||
50 | |||
51 | /** |
||
52 | * Parse robots.txt |
||
53 | * |
||
54 | * @return void |
||
55 | */ |
||
56 | private function parseTxt() |
||
69 | |||
70 | public function add($line) |
||
85 | |||
86 | public function export() |
||
93 | |||
94 | /** |
||
95 | * Check if URL is allowed to crawl |
||
96 | * |
||
97 | * @param string $url - url to check |
||
98 | * @return bool |
||
99 | */ |
||
100 | public function isAllowed($url) |
||
104 | |||
105 | /** |
||
106 | * Check if URL is disallowed to crawl |
||
107 | * |
||
108 | * @param string $url - url to check |
||
109 | * @return bool |
||
110 | */ |
||
111 | public function isDisallowed($url) |
||
115 | |||
116 | /** |
||
117 | * Get sitemaps |
||
118 | * |
||
119 | * @return array |
||
120 | */ |
||
121 | public function getSitemaps() |
||
125 | |||
126 | /** |
||
127 | * Get host |
||
128 | * |
||
129 | * @return string|null |
||
130 | */ |
||
131 | public function getHost() |
||
135 | |||
136 | /** |
||
137 | * Get Clean-param |
||
138 | * |
||
139 | * @return array |
||
140 | */ |
||
141 | public function getCleanParam() |
||
145 | } |
||
146 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: