@@ -9,7 +9,7 @@ |
||
9 | 9 | /** |
10 | 10 | * @inheritdoc |
11 | 11 | */ |
12 | - protected function setupRequest(){ |
|
12 | + protected function setupRequest() { |
|
13 | 13 | $this->Request = new GET(); |
14 | 14 | } |
15 | 15 |
@@ -14,10 +14,10 @@ |
||
14 | 14 | $this->Request = new GETFile(); |
15 | 15 | } |
16 | 16 | protected function setupResponse() { |
17 | - $this->Response = new FileResponse($this->Request->getResponse(),$this->Request->getCurlObject(),$this->downloadDir); |
|
17 | + $this->Response = new FileResponse($this->Request->getResponse(), $this->Request->getCurlObject(), $this->downloadDir); |
|
18 | 18 | } |
19 | 19 | |
20 | - public function downloadTo($path){ |
|
20 | + public function downloadTo($path) { |
|
21 | 21 | $this->downloadDir = $path; |
22 | 22 | return $this; |
23 | 23 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | /** |
10 | 10 | * @inheritdoc |
11 | 11 | */ |
12 | - protected function setupRequest(){ |
|
12 | + protected function setupRequest() { |
|
13 | 13 | $this->Request = new GET(); |
14 | 14 | } |
15 | 15 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | 'platform' |
18 | 18 | ); |
19 | 19 | |
20 | - public function data(array $data){ |
|
20 | + public function data(array $data) { |
|
21 | 21 | $data['grant_type'] = 'password'; |
22 | 22 | return parent::data($data); |
23 | 23 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | 'platform' |
18 | 18 | ); |
19 | 19 | |
20 | - public function data(array $data){ |
|
20 | + public function data(array $data) { |
|
21 | 21 | $data['grant_type'] = 'password'; |
22 | 22 | return parent::data($data); |
23 | 23 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use SugarAPI\SDK\EntryPoint\Abstracts\POST\JSONEntryPoint as POSTEntryPoint; |
6 | 6 | |
7 | -class CreateRecord extends POSTEntryPoint{ |
|
7 | +class CreateRecord extends POSTEntryPoint { |
|
8 | 8 | |
9 | 9 | protected $_URL = '$module'; |
10 | 10 |
@@ -10,7 +10,7 @@ |
||
10 | 10 | /** |
11 | 11 | * Get JSON Response |
12 | 12 | */ |
13 | - public function json(){ |
|
13 | + public function json() { |
|
14 | 14 | return $this->body; |
15 | 15 | } |
16 | 16 |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use SugarAPI\SDK\Response\Interfaces\ResponseInterface; |
6 | 6 | |
7 | -abstract class AbstractResponse implements ResponseInterface{ |
|
7 | +abstract class AbstractResponse implements ResponseInterface { |
|
8 | 8 | |
9 | 9 | protected $CurlResponse; |
10 | 10 | protected $headers; |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | protected $status; |
13 | 13 | protected $error; |
14 | 14 | |
15 | - public function __construct($curlResponse,$curlRequest){ |
|
15 | + public function __construct($curlResponse, $curlRequest) { |
|
16 | 16 | $this->CurlResponse = $curlResponse; |
17 | 17 | if ($this->checkErrors($curlRequest)) { |
18 | 18 | $this->extractResponse($curlRequest); |
@@ -20,18 +20,18 @@ discard block |
||
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | - protected function setStatus($curlRequest){ |
|
24 | - $this->status = curl_getinfo($curlRequest,CURLINFO_HTTP_CODE); |
|
23 | + protected function setStatus($curlRequest) { |
|
24 | + $this->status = curl_getinfo($curlRequest, CURLINFO_HTTP_CODE); |
|
25 | 25 | } |
26 | 26 | |
27 | - protected function extractResponse($curlRequest){ |
|
28 | - $header_size = curl_getinfo($curlRequest,CURLINFO_HEADER_SIZE); |
|
27 | + protected function extractResponse($curlRequest) { |
|
28 | + $header_size = curl_getinfo($curlRequest, CURLINFO_HEADER_SIZE); |
|
29 | 29 | $this->headers = substr($this->CurlResponse, 0, $header_size); |
30 | 30 | $this->body = substr($this->CurlResponse, $header_size); |
31 | 31 | } |
32 | 32 | |
33 | - protected function checkErrors($curlRequest){ |
|
34 | - if (curl_errno($curlRequest) !== CURLE_OK) { |
|
33 | + protected function checkErrors($curlRequest) { |
|
34 | + if (curl_errno($curlRequest)!==CURLE_OK) { |
|
35 | 35 | $this->error = curl_error($curlRequest); |
36 | 36 | return false; |
37 | 37 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * @inheritdoc |
43 | 43 | */ |
44 | - public function getStatus(){ |
|
44 | + public function getStatus() { |
|
45 | 45 | return $this->status; |
46 | 46 | } |
47 | 47 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * @inheritdoc |
64 | 64 | */ |
65 | - public function getError(){ |
|
65 | + public function getError() { |
|
66 | 66 | return $this->error; |
67 | 67 | } |
68 | 68 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | protected $destinationPath; |
19 | 19 | |
20 | - public function __construct($curlResponse, $curlRequest,$destination = null) { |
|
20 | + public function __construct($curlResponse, $curlRequest, $destination = null) { |
|
21 | 21 | parent::__construct($curlResponse, $curlRequest); |
22 | 22 | $this->extractFileName(); |
23 | 23 | if (!empty($destination)) { |
@@ -26,37 +26,37 @@ discard block |
||
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | - protected function setupDestiantion($destination = null){ |
|
30 | - if (empty($destination)){ |
|
29 | + protected function setupDestiantion($destination = null) { |
|
30 | + if (empty($destination)) { |
|
31 | 31 | $destination = sys_get_temp_dir().'/SugarAPI'; |
32 | - if (!file_exists($destination)){ |
|
33 | - mkdir($destination,0777); |
|
32 | + if (!file_exists($destination)) { |
|
33 | + mkdir($destination, 0777); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | $this->destinationPath = $destination; |
37 | 37 | } |
38 | 38 | |
39 | - protected function extractFileName(){ |
|
40 | - foreach (explode("\r\n",$this->headers) as $header) |
|
39 | + protected function extractFileName() { |
|
40 | + foreach (explode("\r\n", $this->headers) as $header) |
|
41 | 41 | { |
42 | - if (strpos($header,'filename')!==FALSE){ |
|
43 | - $this->fileName = substr($header,(strpos($header,"\"")+1),-1); |
|
42 | + if (strpos($header, 'filename')!==FALSE) { |
|
43 | + $this->fileName = substr($header, (strpos($header, "\"") + 1), -1); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | - public function getFileName(){ |
|
48 | + public function getFileName() { |
|
49 | 49 | return $this->fileName; |
50 | 50 | } |
51 | 51 | |
52 | - protected function writeFile(){ |
|
53 | - $fileHandle = fopen($this->file(),'w+'); |
|
54 | - fwrite($fileHandle,$this->body); |
|
52 | + protected function writeFile() { |
|
53 | + $fileHandle = fopen($this->file(), 'w+'); |
|
54 | + fwrite($fileHandle, $this->body); |
|
55 | 55 | fclose($fileHandle); |
56 | 56 | } |
57 | 57 | |
58 | - public function file(){ |
|
59 | - return rtrim($this->destinationPath,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$this->fileName; |
|
58 | + public function file() { |
|
59 | + return rtrim($this->destinationPath, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$this->fileName; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | } |
63 | 63 | \ No newline at end of file |