Completed
Branch master (e874e7)
by smiley
05:21
created

MultiResponse::exec()   B

Complexity

Conditions 5
Paths 12

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 8
nc 12
nop 0
1
<?php
2
/**
3
 * Class MultiResponse
4
 *
5
 * @filesource   MultiResponse.php
6
 * @created      15.02.2016
7
 * @package      chillerlan\TinyCurl
8
 * @author       Smiley <[email protected]>
9
 * @copyright    2016 Smiley
10
 * @license      MIT
11
 */
12
13
namespace chillerlan\TinyCurl;
14
15
/**
16
 *
17
 */
18
class MultiResponse extends ResponseAbstract{
19
20
	/**
21
	 * Fills self::$response_body and calls self::getInfo()
22
	 */
23
	protected function exec(){
24
		$response = explode("\r\n\r\n", curl_multi_getcontent($this->curl), 2);
25
		$headers = isset($response[0]) ? explode("\r\n", $response[0]) : null;
26
		$this->response_body = isset($response[1]) ? $response[1] : null;
27
		$this->getInfo();
28
29
		if(is_array($headers)){
30
			foreach($headers as $line){
31
				$this->headerLine($this->curl, $line);
32
			}
33
		}
34
35
	}
36
37
}
38