1 | <?php |
||
7 | class UserAgentClient implements RobotsTxtInterface |
||
8 | { |
||
9 | protected $allow; |
||
10 | protected $disallow; |
||
11 | |||
12 | protected $userAgent; |
||
13 | protected $origin; |
||
14 | protected $statusCodeParser; |
||
15 | |||
16 | public function __construct($rules, $userAgent, $origin, $statusCode) |
||
23 | |||
24 | protected function validateRules($rules) |
||
33 | |||
34 | /** |
||
35 | * Check if URL is allowed to crawl |
||
36 | * |
||
37 | * @param string $url |
||
38 | * @return bool |
||
39 | */ |
||
40 | public function isAllowed($url) |
||
44 | |||
45 | /** |
||
46 | * Check |
||
47 | * |
||
48 | * @param string $directive |
||
49 | * @param string $url - URL to check |
||
50 | * @return bool |
||
51 | * @throws ParserException |
||
52 | */ |
||
53 | protected function check($directive, $url) |
||
68 | |||
69 | /** |
||
70 | * Check if URL is disallowed to crawl |
||
71 | * |
||
72 | * @param string $url |
||
73 | * @return bool |
||
74 | */ |
||
75 | public function isDisallowed($url) |
||
79 | |||
80 | /** |
||
81 | * Get Crawl-delay |
||
82 | * |
||
83 | * @return array |
||
84 | */ |
||
85 | public function getCrawlDelay() |
||
89 | |||
90 | /** |
||
91 | * Get Cache-delay |
||
92 | * |
||
93 | * @return array |
||
94 | */ |
||
95 | public function getCacheDelay() |
||
99 | } |
||
100 |