@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use SugarAPI\SDK\Request\Abstracts\AbstractRequest; |
| 6 | 6 | |
| 7 | -class POST extends AbstractRequest{ |
|
| 7 | +class POST extends AbstractRequest { |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * @inheritdoc |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * JSON Encode Body |
| 33 | 33 | * @inheritdoc |
| 34 | 34 | */ |
| 35 | - public function setBody($body) { |
|
| 35 | + public function setBody($body){ |
|
| 36 | 36 | return parent::setBody(json_encode($body)); |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | \ No newline at end of file |
@@ -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 | /** |
| 10 | 10 | * Full Curl Response |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | public function __construct($curlResponse,$curlRequest){ |
| 40 | 40 | $this->CurlResponse = $curlResponse; |
| 41 | - if ($this->checkErrors($curlRequest)) { |
|
| 41 | + if ($this->checkErrors($curlRequest)){ |
|
| 42 | 42 | $this->extractResponse($curlRequest); |
| 43 | 43 | } |
| 44 | 44 | $this->setStatus($curlRequest); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @return bool |
| 69 | 69 | */ |
| 70 | 70 | protected function checkErrors($curlRequest){ |
| 71 | - if (curl_errno($curlRequest) !== CURLE_OK) { |
|
| 71 | + if (curl_errno($curlRequest) !== CURLE_OK){ |
|
| 72 | 72 | $this->error = curl_error($curlRequest); |
| 73 | 73 | return false; |
| 74 | 74 | } |
@@ -85,14 +85,14 @@ discard block |
||
| 85 | 85 | /** |
| 86 | 86 | * @inheritdoc |
| 87 | 87 | */ |
| 88 | - public function getBody() { |
|
| 88 | + public function getBody(){ |
|
| 89 | 89 | return $this->body; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * @inheritdoc |
| 94 | 94 | */ |
| 95 | - public function getHeaders() { |
|
| 95 | + public function getHeaders(){ |
|
| 96 | 96 | return $this->headers; |
| 97 | 97 | } |
| 98 | 98 | |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | protected $destinationPath; |
| 20 | 20 | |
| 21 | - public function __construct($curlResponse, $curlRequest,$destination = null) { |
|
| 21 | + public function __construct($curlResponse, $curlRequest,$destination = null){ |
|
| 22 | 22 | parent::__construct($curlResponse, $curlRequest); |
| 23 | 23 | $this->extractFileName(); |
| 24 | - if (!empty($destination)) { |
|
| 24 | + if (!empty($destination)){ |
|
| 25 | 25 | $this->setupDestination($destination); |
| 26 | 26 | $this->writeFile(); |
| 27 | 27 | } |
@@ -45,8 +45,7 @@ discard block |
||
| 45 | 45 | * Extract the filename from the Headers, and store it in filename property |
| 46 | 46 | */ |
| 47 | 47 | protected function extractFileName(){ |
| 48 | - foreach (explode("\r\n",$this->headers) as $header) |
|
| 49 | - { |
|
| 48 | + foreach (explode("\r\n",$this->headers) as $header){ |
|
| 50 | 49 | if (strpos($header,'filename')!==FALSE){ |
| 51 | 50 | $this->fileName = substr($header,(strpos($header,"\"")+1),-1); |
| 52 | 51 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | /** |
| 18 | 18 | * @inheritdoc |
| 19 | 19 | */ |
| 20 | - public function getBody($asArray = true) { |
|
| 20 | + public function getBody($asArray = true){ |
|
| 21 | 21 | return json_decode($this->body,$asArray); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | class EntryPointException extends SDKException { |
| 6 | 6 | |
| 7 | - public function __construct($message) { |
|
| 7 | + public function __construct($message){ |
|
| 8 | 8 | parent::__construct($message); |
| 9 | 9 | } |
| 10 | 10 | |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | class EntryPointException extends SDKException { |
| 6 | 6 | |
| 7 | - public function __construct($message) { |
|
| 7 | + public function __construct($message){ |
|
| 8 | 8 | parent::__construct($message); |
| 9 | 9 | } |
| 10 | 10 | |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | protected $message = 'EntryPoint Exception [%s] occurred on EntryPoint %s: %s'; |
| 10 | 10 | |
| 11 | - public function __construct($EntryPoint,$data) { |
|
| 11 | + public function __construct($EntryPoint,$data){ |
|
| 12 | 12 | parent::__construct(sprintf($this->message,get_called_class(),$EntryPoint,$data)); |
| 13 | 13 | } |
| 14 | 14 | |
@@ -8,12 +8,12 @@ |
||
| 8 | 8 | |
| 9 | 9 | abstract class AbstractPostFileEntryPoint extends AbstractEntryPoint { |
| 10 | 10 | |
| 11 | - public function __construct($url, array $options = array()) { |
|
| 11 | + public function __construct($url, array $options = array()){ |
|
| 12 | 12 | $this->setRequest(new POSTFile()); |
| 13 | 13 | parent::__construct($url, $options); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - public function execute($data = null) { |
|
| 16 | + public function execute($data = null){ |
|
| 17 | 17 | parent::execute($data); |
| 18 | 18 | $this->setResponse(new JSON($this->Request->getResponse(),$this->Request->getCurlObject())); |
| 19 | 19 | return $this; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | protected function configureData($data){ |
| 35 | 35 | if (!empty($this->Options)){ |
| 36 | 36 | $fileField = end($this->Options); |
| 37 | - }else{ |
|
| 37 | + } else{ |
|
| 38 | 38 | throw new RequiredOptionsException(get_called_class()); |
| 39 | 39 | } |
| 40 | 40 | if (is_string($data) && isset($fileField)){ |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | if (is_array($data)){ |
| 46 | 46 | if (isset($fileField)){ |
| 47 | 47 | $data[$fileField] = $this->setFileFieldValue($data[$fileField]); |
| 48 | - }else{ |
|
| 48 | + } else{ |
|
| 49 | 49 | foreach ($this->Data as $key => $value){ |
| 50 | 50 | if (!array_key_exists($key,$this->_REQUIRED_DATA)){ |
| 51 | 51 | $data[$key] = $this->setFileFieldValue($value); |