Conditions | 3 |
Paths | 4 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3.0261 |
Changes | 0 |
1 | <?php |
||
35 | 1 | public function __construct(TelegramResponse $response) |
|
36 | { |
||
37 | 1 | $headers = (array) $response->getHeaders(); |
|
38 | |||
39 | // What better to get the mime type than what the Telegram servers already send us? |
||
40 | 1 | $this->mime_type = !empty($headers['Content-Type']) ? $headers['Content-Type'] : 'application/octet-stream'; |
|
41 | |||
42 | // Same with file length |
||
43 | 1 | $this->file_size = !empty($headers['Content-Length']) ? $headers['Content-Length'] |
|
44 | : strlen($response->getRawData()); |
||
45 | 1 | $this->contents = $response->getRawData(); |
|
46 | 1 | } |
|
47 | |||
57 |