1 | <?php |
||
16 | class UserAgentClient implements RobotsTxtInterface |
||
17 | { |
||
18 | use UrlParser; |
||
19 | |||
20 | /** |
||
21 | * Rules |
||
22 | * @var array |
||
23 | */ |
||
24 | private $rules; |
||
25 | |||
26 | /** |
||
27 | * User-agent |
||
28 | * @var string |
||
29 | */ |
||
30 | private $userAgent; |
||
31 | |||
32 | /** |
||
33 | * Origin user-agent |
||
34 | * @var string |
||
35 | */ |
||
36 | private $userAgentOrigin; |
||
37 | |||
38 | /** |
||
39 | * Robots.txt base URL |
||
40 | * @var string |
||
41 | */ |
||
42 | private $base; |
||
43 | |||
44 | /** |
||
45 | * Status code parser |
||
46 | * @var StatusCodeParser |
||
47 | */ |
||
48 | private $statusCodeParser; |
||
49 | |||
50 | /** |
||
51 | * Comment export status |
||
52 | * @var bool |
||
53 | */ |
||
54 | private $commentsExported = false; |
||
55 | |||
56 | /** |
||
57 | * UserAgentClient constructor. |
||
58 | * |
||
59 | * @param string $userAgent |
||
60 | * @param UserAgentParser $rules |
||
61 | * @param string $baseUri |
||
62 | * @param int|null $statusCode |
||
63 | */ |
||
64 | public function __construct($userAgent, UserAgentParser $rules, $baseUri, $statusCode) |
||
75 | |||
76 | /** |
||
77 | * Check if URL is allowed to crawl |
||
78 | * |
||
79 | * @param string $url |
||
80 | * @return bool |
||
81 | */ |
||
82 | public function isAllowed($url) |
||
86 | |||
87 | /** |
||
88 | * Check |
||
89 | * |
||
90 | * @param string $directive |
||
91 | * @param string $url - URL to check |
||
92 | * @return bool |
||
93 | * @throws ClientException |
||
94 | */ |
||
95 | private function check($directive, $url) |
||
118 | |||
119 | /** |
||
120 | * Check if the URL belongs to current robots.txt |
||
121 | * |
||
122 | * @param $urls |
||
123 | * @return bool |
||
124 | */ |
||
125 | private function isUrlApplicable($urls) |
||
139 | |||
140 | /** |
||
141 | * Check if URL is disallowed to crawl |
||
142 | * |
||
143 | * @param string $url |
||
144 | * @return bool |
||
145 | */ |
||
146 | public function isDisallowed($url) |
||
150 | |||
151 | /** |
||
152 | * Cache-delay |
||
153 | * |
||
154 | * @return DelayClient |
||
155 | */ |
||
156 | public function cacheDelay() |
||
162 | |||
163 | /** |
||
164 | * Crawl-delay |
||
165 | * |
||
166 | * @return DelayClient |
||
167 | */ |
||
168 | public function crawlDelay() |
||
174 | |||
175 | /** |
||
176 | * RequestClient-rate |
||
177 | * |
||
178 | * @return RequestRateClient |
||
179 | */ |
||
180 | public function requestRate() |
||
186 | |||
187 | /** |
||
188 | * Robot-version |
||
189 | * |
||
190 | * @return RobotVersionClient |
||
191 | */ |
||
192 | public function robotVersion() |
||
197 | |||
198 | /** |
||
199 | * Rule export |
||
200 | * |
||
201 | * @return array |
||
202 | */ |
||
203 | public function export() |
||
216 | |||
217 | /** |
||
218 | * Visit-time |
||
219 | * |
||
220 | * @return VisitTimeClient |
||
221 | */ |
||
222 | public function visitTime() |
||
228 | |||
229 | /** |
||
230 | * UserAgentClient destructor. |
||
231 | */ |
||
232 | public function __destruct() |
||
241 | |||
242 | /** |
||
243 | * Comment |
||
244 | * |
||
245 | * @return CommentClient |
||
246 | */ |
||
247 | public function comment() |
||
254 | } |
||
255 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..