1 | <?php |
||
18 | class TxtClient extends RobotsTxtParser |
||
19 | { |
||
20 | use UrlParser; |
||
21 | |||
22 | /** |
||
23 | * Status code |
||
24 | * @var int|null |
||
25 | */ |
||
26 | protected $statusCode; |
||
27 | |||
28 | /** |
||
29 | * Robots.txt content |
||
30 | * @var string |
||
31 | */ |
||
32 | private $content; |
||
33 | |||
34 | /** |
||
35 | * TxtClient constructor. |
||
36 | * |
||
37 | * @param string $baseUri |
||
38 | * @param int $statusCode |
||
39 | * @param string|null $content |
||
40 | * @param string $encoding |
||
41 | * @param int|null $byteLimit |
||
42 | */ |
||
43 | public function __construct($baseUri, $statusCode, $content, $encoding = self::ENCODING, $byteLimit = self::BYTE_LIMIT) |
||
51 | |||
52 | /** |
||
53 | * Convert character encoding |
||
54 | * |
||
55 | * @param string $encoding |
||
56 | * @return string |
||
57 | */ |
||
58 | private function convertEncoding($encoding) |
||
67 | |||
68 | /** |
||
69 | * Byte limit |
||
70 | * |
||
71 | * @param int|null $bytes |
||
72 | * @return string |
||
73 | * @throws ClientException |
||
74 | */ |
||
75 | private function limitBytes($bytes) |
||
84 | |||
85 | /** |
||
86 | * Clean-param |
||
87 | * |
||
88 | * @return CleanParamClient |
||
89 | */ |
||
90 | public function cleanParam() |
||
94 | |||
95 | /** |
||
96 | * Host |
||
97 | * |
||
98 | * @return HostClient |
||
99 | */ |
||
100 | public function host() |
||
104 | |||
105 | /** |
||
106 | * Sitemaps |
||
107 | * |
||
108 | * @return SitemapClient |
||
109 | */ |
||
110 | public function sitemap() |
||
114 | |||
115 | /** |
||
116 | * Get User-agent list |
||
117 | * |
||
118 | * @return string[] |
||
119 | */ |
||
120 | public function getUserAgents() |
||
124 | |||
125 | /** |
||
126 | * Client User-agent specific rules |
||
127 | * |
||
128 | * @param string $string |
||
129 | * @return UserAgentClient |
||
130 | */ |
||
131 | public function userAgent($string = self::USER_AGENT) |
||
135 | } |
||
136 |