1 | <?php |
||
17 | class Basic extends RobotsTxtParser |
||
18 | { |
||
19 | use UrlParser; |
||
20 | |||
21 | /** |
||
22 | * Base uri |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $base; |
||
26 | |||
27 | /** |
||
28 | * Status code |
||
29 | * @var int|null |
||
30 | */ |
||
31 | protected $statusCode; |
||
32 | |||
33 | /** |
||
34 | * Robots.txt content |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $content; |
||
38 | |||
39 | /** |
||
40 | * Basic constructor. |
||
41 | * |
||
42 | * @param string $baseUri |
||
43 | * @param int $statusCode |
||
44 | * @param string|null $content |
||
45 | * @param string $encoding |
||
46 | * @param int|null $byteLimit |
||
47 | */ |
||
48 | public function __construct($baseUri, $statusCode, $content, $encoding = self::ENCODING, $byteLimit = self::BYTE_LIMIT) |
||
57 | |||
58 | /** |
||
59 | * Convert character encoding |
||
60 | * |
||
61 | * @param string $encoding |
||
62 | * @return string |
||
63 | */ |
||
64 | private function convertEncoding($encoding) |
||
73 | |||
74 | /** |
||
75 | * Byte limit |
||
76 | * |
||
77 | * @param int|null $bytes |
||
78 | * @return string |
||
79 | */ |
||
80 | private function limitBytes($bytes) |
||
89 | |||
90 | /** |
||
91 | * Clean-param |
||
92 | * |
||
93 | * @return CleanParamClient |
||
94 | */ |
||
95 | public function cleanParam() |
||
99 | |||
100 | /** |
||
101 | * Host |
||
102 | * |
||
103 | * @return HostClient |
||
104 | */ |
||
105 | public function host() |
||
109 | |||
110 | /** |
||
111 | * Sitemaps |
||
112 | * |
||
113 | * @return SitemapClient |
||
114 | */ |
||
115 | public function sitemap() |
||
119 | |||
120 | /** |
||
121 | * Get User-agent list |
||
122 | * |
||
123 | * @return string[] |
||
124 | */ |
||
125 | public function getUserAgents() |
||
129 | |||
130 | /** |
||
131 | * Client User-agent specific rules |
||
132 | * |
||
133 | * @param string $string |
||
134 | * @return UserAgentClient |
||
135 | */ |
||
136 | public function userAgent($string = self::USER_AGENT) |
||
140 | } |
||
141 |