1 | <?php |
||
13 | class Download implements RobotsTxtInterface |
||
14 | { |
||
15 | /** |
||
16 | * Base uri |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $baseUri; |
||
20 | |||
21 | /** |
||
22 | * HTTP Status code |
||
23 | * @var int |
||
24 | */ |
||
25 | protected $statusCode; |
||
26 | |||
27 | /** |
||
28 | * Robots.txt contents |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $contents; |
||
32 | |||
33 | /** |
||
34 | * Robots.txt character encoding |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $encoding; |
||
38 | |||
39 | /** |
||
40 | * Download constructor. |
||
41 | * |
||
42 | * @param string $baseUri |
||
43 | * @param array $guzzleConfig |
||
44 | */ |
||
45 | public function __construct($baseUri, $guzzleConfig = []) |
||
82 | |||
83 | /** |
||
84 | * HTTP header encoding |
||
85 | * |
||
86 | * @param array $headers |
||
87 | * @return string |
||
88 | */ |
||
89 | protected function headerEncoding($headers) |
||
104 | |||
105 | /** |
||
106 | * Manually detect encoding |
||
107 | * |
||
108 | * @return string |
||
109 | */ |
||
110 | protected function detectEncoding() |
||
117 | |||
118 | /** |
||
119 | * URL content |
||
120 | * |
||
121 | * @return string |
||
122 | */ |
||
123 | public function getContents() |
||
127 | |||
128 | /** |
||
129 | * Parser client |
||
130 | * |
||
131 | * @param int|null $byteLimit |
||
132 | * @return Client |
||
133 | */ |
||
134 | public function parserClient($byteLimit = self::BYTE_LIMIT) |
||
138 | |||
139 | /** |
||
140 | * Status code |
||
141 | * |
||
142 | * @return int |
||
143 | */ |
||
144 | public function getStatusCode() |
||
148 | |||
149 | /** |
||
150 | * Encoding |
||
151 | * |
||
152 | * @return string |
||
153 | */ |
||
154 | public function getEncoding() |
||
158 | } |
||
159 |