1 | <?php |
||
8 | class UserAgentClient implements RobotsTxtInterface |
||
9 | { |
||
10 | protected $allow; |
||
11 | protected $disallow; |
||
12 | |||
13 | protected $userAgent; |
||
14 | protected $origin; |
||
15 | protected $statusCodeParser; |
||
16 | |||
17 | /** |
||
18 | * UserAgentClient constructor. |
||
19 | * |
||
20 | * @param array $rules |
||
21 | * @param string $userAgent |
||
22 | * @param string $origin |
||
23 | * @param int $statusCode |
||
24 | */ |
||
25 | public function __construct($rules, $userAgent, $origin, $statusCode) |
||
32 | |||
33 | protected function validateRules($rules) |
||
42 | |||
43 | /** |
||
44 | * Check if URL is allowed to crawl |
||
45 | * |
||
46 | * @param string $url |
||
47 | * @return bool |
||
48 | */ |
||
49 | public function isAllowed($url) |
||
53 | |||
54 | /** |
||
55 | * Check |
||
56 | * |
||
57 | * @param string $directive |
||
58 | * @param string $url - URL to check |
||
59 | * @return bool |
||
60 | * @throws ClientException |
||
61 | */ |
||
62 | protected function check($directive, $url) |
||
79 | |||
80 | protected function isUrlApplicable($urls) |
||
94 | |||
95 | /** |
||
96 | * Check if URL is disallowed to crawl |
||
97 | * |
||
98 | * @param string $url |
||
99 | * @return bool |
||
100 | */ |
||
101 | public function isDisallowed($url) |
||
105 | |||
106 | /** |
||
107 | * Get Cache-delay |
||
108 | * |
||
109 | * @return float|int |
||
110 | */ |
||
111 | public function getCacheDelay() |
||
116 | |||
117 | /** |
||
118 | * Get Crawl-delay |
||
119 | * |
||
120 | * @return float|int |
||
121 | */ |
||
122 | public function getCrawlDelay() |
||
127 | } |
||
128 |