@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | protected $destinationPath; |
23 | 23 | |
24 | 24 | public function __construct($curlRequest, $curlResponse = NULL, $destination = NULL){ |
25 | - parent::__construct($curlRequest,$curlResponse); |
|
25 | + parent::__construct($curlRequest, $curlResponse); |
|
26 | 26 | $this->setDestinationPath($destination); |
27 | 27 | } |
28 | 28 | |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | * Extract Filename from Headers |
32 | 32 | * @param mixed $curlResponse |
33 | 33 | */ |
34 | - public function setCurlResponse($curlResponse) { |
|
34 | + public function setCurlResponse($curlResponse){ |
|
35 | 35 | parent::setCurlResponse($curlResponse); |
36 | - if (!$this->error) { |
|
37 | - if (empty($this->fileName)) { |
|
36 | + if (!$this->error){ |
|
37 | + if (empty($this->fileName)){ |
|
38 | 38 | $this->extractFileName(); |
39 | 39 | } |
40 | 40 | $this->writeFile(); |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | mkdir($this->destinationPath, 0777); |
96 | 96 | } |
97 | 97 | $file = $this->file(); |
98 | - $fileHandle = fopen($file,'w+'); |
|
99 | - fwrite($fileHandle,$this->body); |
|
98 | + $fileHandle = fopen($file, 'w+'); |
|
99 | + fwrite($fileHandle, $this->body); |
|
100 | 100 | fclose($fileHandle); |
101 | 101 | return $file; |
102 | 102 | }else{ |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | * Extract Filename from Headers |
32 | 32 | * @param mixed $curlResponse |
33 | 33 | */ |
34 | - public function setCurlResponse($curlResponse) { |
|
34 | + public function setCurlResponse($curlResponse){ |
|
35 | 35 | parent::setCurlResponse($curlResponse); |
36 | - if (!$this->error) { |
|
37 | - if (empty($this->fileName)) { |
|
36 | + if (!$this->error){ |
|
37 | + if (empty($this->fileName)){ |
|
38 | 38 | $this->extractFileName(); |
39 | 39 | } |
40 | 40 | $this->writeFile(); |
@@ -59,8 +59,7 @@ discard block |
||
59 | 59 | * Extract the filename from the Headers, and store it in filename property |
60 | 60 | */ |
61 | 61 | protected function extractFileName(){ |
62 | - foreach (explode("\r\n", $this->headers) as $header) |
|
63 | - { |
|
62 | + foreach (explode("\r\n", $this->headers) as $header){ |
|
64 | 63 | if (strpos($header, 'filename')!==FALSE){ |
65 | 64 | $this->setFileName(substr($header, (strpos($header, "\"")+1), -1)); |
66 | 65 | } |
@@ -99,7 +98,7 @@ discard block |
||
99 | 98 | fwrite($fileHandle,$this->body); |
100 | 99 | fclose($fileHandle); |
101 | 100 | return $file; |
102 | - }else{ |
|
101 | + } else{ |
|
103 | 102 | return FALSE; |
104 | 103 | } |
105 | 104 | } |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | */ |
46 | 46 | protected $info; |
47 | 47 | |
48 | - public function __construct($curlRequest,$curlResponse = NULL){ |
|
48 | + public function __construct($curlRequest, $curlResponse = NULL){ |
|
49 | 49 | $this->CurlRequest = $curlRequest; |
50 | 50 | if ($curlResponse!==NULL){ |
51 | 51 | $this->setCurlResponse($curlResponse); |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - public function setCurlResponse($curlResponse) { |
|
55 | + public function setCurlResponse($curlResponse){ |
|
56 | 56 | $this->extractInfo(); |
57 | 57 | if (!$this->getError()){ |
58 | 58 | $this->extractResponse($curlResponse); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | protected function extractInfo(){ |
67 | 67 | $this->info = curl_getinfo($this->CurlRequest); |
68 | 68 | $this->status = $this->info['http_code']; |
69 | - if (curl_errno($this->CurlRequest)!== CURLE_OK){ |
|
69 | + if (curl_errno($this->CurlRequest)!==CURLE_OK){ |
|
70 | 70 | $this->error = curl_error($this->CurlRequest); |
71 | 71 | } |
72 | 72 | $this->error = FALSE; |
@@ -52,7 +52,7 @@ |
||
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - public function setCurlResponse($curlResponse) { |
|
55 | + public function setCurlResponse($curlResponse){ |
|
56 | 56 | $this->extractInfo(); |
57 | 57 | if (!$this->getError()){ |
58 | 58 | $this->extractResponse($curlResponse); |
@@ -12,7 +12,7 @@ |
||
12 | 12 | * The directory in which to download the File |
13 | 13 | * @var string |
14 | 14 | */ |
15 | - protected $downloadDir = null; |
|
15 | + protected $downloadDir = NULL; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @inheritdoc |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | abstract class AbstractGetEntryPoint extends AbstractEntryPoint { |
13 | 13 | |
14 | - public function __construct($url, array $options = array()) { |
|
14 | + public function __construct($url, array $options = array()){ |
|
15 | 15 | $this->setRequest(new GET()); |
16 | 16 | $this->setResponse(new JSON($this->Request->getCurlObject())); |
17 | 17 | parent::__construct($url, $options); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | abstract class AbstractGetEntryPoint extends AbstractEntryPoint { |
13 | 13 | |
14 | - public function __construct($url, array $options = array()) { |
|
14 | + public function __construct($url, array $options = array()){ |
|
15 | 15 | $this->setRequest(new GET()); |
16 | 16 | $this->setResponse(new JSON($this->Request->getCurlObject())); |
17 | 17 | parent::__construct($url, $options); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | abstract class AbstractPostEntryPoint extends AbstractEntryPoint { |
13 | 13 | |
14 | - public function __construct($url, array $options = array()) { |
|
14 | + public function __construct($url, array $options = array()){ |
|
15 | 15 | $this->setRequest(new POST()); |
16 | 16 | $this->setResponse(new JSON($this->Request->getCurlObject())); |
17 | 17 | parent::__construct($url, $options); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | abstract class AbstractPostEntryPoint extends AbstractEntryPoint { |
13 | 13 | |
14 | - public function __construct($url, array $options = array()) { |
|
14 | + public function __construct($url, array $options = array()){ |
|
15 | 15 | $this->setRequest(new POST()); |
16 | 16 | $this->setResponse(new JSON($this->Request->getCurlObject())); |
17 | 17 | parent::__construct($url, $options); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | abstract class AbstractDeleteEntryPoint extends AbstractEntryPoint { |
13 | 13 | |
14 | - public function __construct($url, array $options = array()) { |
|
14 | + public function __construct($url, array $options = array()){ |
|
15 | 15 | $this->setRequest(new DELETE()); |
16 | 16 | $this->setResponse(new JSON($this->getRequest()->getCurlObject())); |
17 | 17 | parent::__construct($url, $options); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | abstract class AbstractDeleteEntryPoint extends AbstractEntryPoint { |
13 | 13 | |
14 | - public function __construct($url, array $options = array()) { |
|
14 | + public function __construct($url, array $options = array()){ |
|
15 | 15 | $this->setRequest(new DELETE()); |
16 | 16 | $this->setResponse(new JSON($this->getRequest()->getCurlObject())); |
17 | 17 | parent::__construct($url, $options); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | abstract class AbstractPutEntryPoint extends AbstractEntryPoint { |
13 | 13 | |
14 | - public function __construct($url, array $options = array()) { |
|
14 | + public function __construct($url, array $options = array()){ |
|
15 | 15 | $this->setRequest(new PUT()); |
16 | 16 | $this->setResponse(new JSON($this->Request->getCurlObject())); |
17 | 17 | parent::__construct($url, $options); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | abstract class AbstractPutEntryPoint extends AbstractEntryPoint { |
13 | 13 | |
14 | - public function __construct($url, array $options = array()) { |
|
14 | + public function __construct($url, array $options = array()){ |
|
15 | 15 | $this->setRequest(new PUT()); |
16 | 16 | $this->setResponse(new JSON($this->Request->getCurlObject())); |
17 | 17 | parent::__construct($url, $options); |