1 | <?php |
||
19 | class TxtClient extends RobotsTxtParser |
||
20 | { |
||
21 | use UriParser; |
||
22 | |||
23 | /** |
||
24 | * Status code |
||
25 | * @var int|null |
||
26 | */ |
||
27 | private $statusCode; |
||
28 | |||
29 | /** |
||
30 | * Robots.txt content |
||
31 | * @var string |
||
32 | */ |
||
33 | private $content; |
||
34 | |||
35 | /** |
||
36 | * Encoding |
||
37 | * @var string |
||
38 | */ |
||
39 | private $encoding; |
||
40 | |||
41 | /** |
||
42 | * TxtClient constructor. |
||
43 | * |
||
44 | * @param string $baseUri |
||
45 | * @param int|null $statusCode |
||
46 | * @param string $content |
||
47 | * @param string $encoding |
||
48 | * @param string|null $effectiveUri |
||
49 | * @param int|null $byteLimit |
||
50 | */ |
||
51 | public function __construct($baseUri, $statusCode, $content, $encoding = self::ENCODING, $effectiveUri = null, $byteLimit = self::BYTE_LIMIT) |
||
60 | |||
61 | /** |
||
62 | * Convert character encoding |
||
63 | * |
||
64 | * @return string |
||
65 | */ |
||
66 | private function convertEncoding() |
||
77 | |||
78 | /** |
||
79 | * Byte limit |
||
80 | * |
||
81 | * @param int|null $bytes |
||
82 | * @return string |
||
83 | * @throws ClientException |
||
84 | */ |
||
85 | private function limitBytes($bytes) |
||
94 | |||
95 | /** |
||
96 | * Get User-agent list |
||
97 | * |
||
98 | * @return string[] |
||
99 | */ |
||
100 | public function getUserAgents() |
||
104 | |||
105 | /** |
||
106 | * Clean-param |
||
107 | * |
||
108 | * @return CleanParamClient |
||
109 | */ |
||
110 | public function cleanParam() |
||
114 | |||
115 | /** |
||
116 | * Host |
||
117 | * |
||
118 | * @return HostClient |
||
119 | */ |
||
120 | public function host() |
||
124 | |||
125 | /** |
||
126 | * Sitemaps |
||
127 | * |
||
128 | * @return SitemapClient |
||
129 | */ |
||
130 | public function sitemap() |
||
134 | |||
135 | /** |
||
136 | * User-agent specific rules |
||
137 | * |
||
138 | * @param string $string |
||
139 | * @return UserAgentClient |
||
140 | */ |
||
141 | public function userAgent($string = self::USER_AGENT) |
||
145 | } |
||
146 |