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 $header |
||
87 | * @return string |
||
88 | */ |
||
89 | protected function headerEncoding($header) |
||
102 | |||
103 | /** |
||
104 | * Manually detect encoding |
||
105 | * |
||
106 | * @return string |
||
107 | */ |
||
108 | protected function detectEncoding() |
||
115 | |||
116 | /** |
||
117 | * URL content |
||
118 | * |
||
119 | * @return string |
||
120 | */ |
||
121 | public function getContents() |
||
125 | |||
126 | /** |
||
127 | * Parser client |
||
128 | * |
||
129 | * @param int|null $byteLimit |
||
130 | * @return Client |
||
131 | */ |
||
132 | public function parserClient($byteLimit = self::BYTE_LIMIT) |
||
136 | |||
137 | /** |
||
138 | * Status code |
||
139 | * |
||
140 | * @return int |
||
141 | */ |
||
142 | public function getStatusCode() |
||
146 | |||
147 | /** |
||
148 | * Encoding |
||
149 | * |
||
150 | * @return string |
||
151 | */ |
||
152 | public function getEncoding() |
||
156 | } |
||
157 |