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