@@ -133,6 +133,7 @@ |
||
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | 135 | * @inheritdoc |
| 136 | + * @param string $body |
|
| 136 | 137 | */ |
| 137 | 138 | public function setBody($body) { |
| 138 | 139 | $this->body = $body; |
@@ -19,6 +19,6 @@ |
||
| 19 | 19 | print_r($getResponse->getBody()); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -}catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
| 22 | +} catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
| 23 | 23 | print $ex->getMessage(); |
| 24 | 24 | } |
| 25 | 25 | \ No newline at end of file |
@@ -14,12 +14,12 @@ |
||
| 14 | 14 | echo "File downloaded to ".$response->file(); |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - }else{ |
|
| 17 | + } else{ |
|
| 18 | 18 | echo "Failed to retrieve Note<br>"; |
| 19 | 19 | echo "Response: ".$response->getStatus()."<br>"; |
| 20 | 20 | print_r($response->getBody()); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -}catch(\SugarAPI\SDK\Exception\SDKException $ex){ |
|
| 23 | +} catch(\SugarAPI\SDK\Exception\SDKException $ex){ |
|
| 24 | 24 | print $ex->getMessage(); |
| 25 | 25 | } |
| 26 | 26 | \ No newline at end of file |
@@ -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 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | print_r($response); |
| 14 | 14 | |
| 15 | -}catch (\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
| 15 | +} catch (\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
| 16 | 16 | print $ex->getMessage(); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -15,18 +15,18 @@ |
||
| 15 | 15 | if ($response->getStatus()=='200'){ |
| 16 | 16 | $record = $response->getBody(); |
| 17 | 17 | print_r($record); |
| 18 | - }else{ |
|
| 18 | + } else{ |
|
| 19 | 19 | print_r($upload->getRequest()); |
| 20 | 20 | echo "Failed to Update Note with File<br>"; |
| 21 | 21 | echo "Response: ".$response->getStatus()."<br>"; |
| 22 | 22 | print_r($response->getBody()); |
| 23 | 23 | } |
| 24 | - }else{ |
|
| 24 | + } else{ |
|
| 25 | 25 | echo "Failed to create Note<br>"; |
| 26 | 26 | echo "Response: ".$response->getStatus()."<br>"; |
| 27 | 27 | print_r($response->getBody()); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | -}catch (\SugarAPI\SDK\Exception\SDKException $ex){ |
|
| 30 | +} catch (\SugarAPI\SDK\Exception\SDKException $ex){ |
|
| 31 | 31 | print $ex->getMessage(); |
| 32 | 32 | } |
| 33 | 33 | \ No newline at end of file |
@@ -37,31 +37,31 @@ |
||
| 37 | 37 | $response = $deleteRecord->getResponse()->getBody(); |
| 38 | 38 | echo "Deleted Record <br>"; |
| 39 | 39 | print_r($response); |
| 40 | - }else{ |
|
| 40 | + } else{ |
|
| 41 | 41 | echo "Failed to Delete record<br>"; |
| 42 | 42 | echo "Response: ".$response->getStatus()."<br>"; |
| 43 | 43 | print_r($response->getBody()); |
| 44 | 44 | } |
| 45 | - }else{ |
|
| 45 | + } else{ |
|
| 46 | 46 | print_r($updateRecord->getRequest()); |
| 47 | 47 | echo "Failed to Update record<br>"; |
| 48 | 48 | echo "Response: ".$response->getStatus()."<br>"; |
| 49 | 49 | print_r($response->getBody()); |
| 50 | 50 | } |
| 51 | - }else{ |
|
| 51 | + } else{ |
|
| 52 | 52 | echo "Failed to retrieve record<br>"; |
| 53 | 53 | echo "Response: ".$response->getStatus()."<br>"; |
| 54 | 54 | print_r($response->getBody()); |
| 55 | 55 | } |
| 56 | - }else{ |
|
| 56 | + } else{ |
|
| 57 | 57 | echo "Response: ".$response->getStatus(); |
| 58 | 58 | print_r($response->getBody()); |
| 59 | 59 | } |
| 60 | -}catch (\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
| 60 | +} catch (\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
| 61 | 61 | echo "Auth Options:<pre>"; |
| 62 | 62 | print_r($SugarAPI->getAuthOptions()); |
| 63 | 63 | echo "</pre> Error Message: "; |
| 64 | 64 | print $ex->getMessage(); |
| 65 | -}catch (\SugarAPI\SDK\Exception\SDKException $ex){ |
|
| 65 | +} catch (\SugarAPI\SDK\Exception\SDKException $ex){ |
|
| 66 | 66 | echo $ex->__toString(); |
| 67 | 67 | } |