1 | <?php |
||
12 | class Checks implements RobotsTxtInterface |
||
13 | { |
||
14 | use UrlParser; |
||
15 | use DirectiveParserCommons; |
||
16 | |||
17 | /** |
||
18 | * Base Uri |
||
19 | * @var string |
||
20 | */ |
||
21 | private $base; |
||
22 | |||
23 | /** |
||
24 | * Status code |
||
25 | * @var int|null |
||
26 | */ |
||
27 | private $statusCode; |
||
28 | |||
29 | /** |
||
30 | * Rules |
||
31 | * @var SubDirectiveHandler |
||
32 | */ |
||
33 | private $handler; |
||
34 | |||
35 | /** |
||
36 | * DisAllowClient constructor. |
||
37 | * |
||
38 | * @param string $base |
||
39 | * @param int|null $statusCode |
||
40 | * @param SubDirectiveHandler $handler |
||
41 | */ |
||
42 | public function __construct($base, $statusCode, SubDirectiveHandler $handler) |
||
48 | |||
49 | /** |
||
50 | * Check if URL is allowed to crawl |
||
51 | * |
||
52 | * @param string $url |
||
53 | * @return bool |
||
54 | */ |
||
55 | public function isAllowed($url) |
||
59 | |||
60 | /** |
||
61 | * Check |
||
62 | * |
||
63 | * @param string $directive |
||
64 | * @param string $url - URL to check |
||
65 | * @return bool |
||
66 | * @throws ClientException |
||
67 | */ |
||
68 | private function check($directive, $url) |
||
96 | |||
97 | /** |
||
98 | * Check if the URL belongs to current robots.txt |
||
99 | * |
||
100 | * @param string[] $urls |
||
101 | * @return bool |
||
102 | */ |
||
103 | private function isUrlApplicable($urls) |
||
117 | |||
118 | /** |
||
119 | * Check if URL is disallowed to crawl |
||
120 | * |
||
121 | * @param string $url |
||
122 | * @return bool |
||
123 | */ |
||
124 | public function isDisallowed($url) |
||
128 | } |
||
129 |