@@ -39,7 +39,7 @@ |
||
| 39 | 39 | public static function getSDKEntryPointRegistry(){ |
| 40 | 40 | $entryPoints = array(); |
| 41 | 41 | require __DIR__.DIRECTORY_SEPARATOR.'registry.php'; |
| 42 | - foreach ($entryPoints as $funcName => $className) { |
|
| 42 | + foreach ($entryPoints as $funcName => $className){ |
|
| 43 | 43 | $className = "SugarAPI\\SDK\\EntryPoint\\" . $className; |
| 44 | 44 | $entryPoints[$funcName] = $className; |
| 45 | 45 | } |
@@ -32,13 +32,13 @@ |
||
| 32 | 32 | * @throws RequiredOptionsException |
| 33 | 33 | */ |
| 34 | 34 | protected function configureData($data){ |
| 35 | - if (is_string($data)) { |
|
| 36 | - if (!empty($this->Options)) { |
|
| 35 | + if (is_string($data)){ |
|
| 36 | + if (!empty($this->Options)){ |
|
| 37 | 37 | $fileField = end($this->Options); |
| 38 | 38 | $data = array( |
| 39 | 39 | $fileField => $data |
| 40 | 40 | ); |
| 41 | - } else { |
|
| 41 | + } else{ |
|
| 42 | 42 | throw new RequiredOptionsException(get_called_class(), "Options are required, when passing String for data."); |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -30,19 +30,19 @@ |
||
| 30 | 30 | 'method' => '' |
| 31 | 31 | ); |
| 32 | 32 | |
| 33 | - protected function configureData($data) { |
|
| 34 | - if (!isset($data['requests'])) { |
|
| 33 | + protected function configureData($data){ |
|
| 34 | + if (!isset($data['requests'])){ |
|
| 35 | 35 | $requestData = array( |
| 36 | 36 | 'requests' => array() |
| 37 | 37 | ); |
| 38 | 38 | $counter = 0; |
| 39 | - foreach ($data as $key => $EntryPoint) { |
|
| 40 | - if (is_object($EntryPoint)) { |
|
| 39 | + foreach ($data as $key => $EntryPoint){ |
|
| 40 | + if (is_object($EntryPoint)){ |
|
| 41 | 41 | $requestData['requests'][$counter] = $this->bulkRequest; |
| 42 | 42 | $requestData['requests'][$counter]['method'] = $EntryPoint->getRequest()->getType(); |
| 43 | - if ($requestData['requests'][$counter]['method'] == "POST" || $requestData['requests'][$counter]['method'] == "PUT") { |
|
| 43 | + if ($requestData['requests'][$counter]['method'] == "POST" || $requestData['requests'][$counter]['method'] == "PUT"){ |
|
| 44 | 44 | $requestData['requests'][$counter]['data'] = json_encode($EntryPoint->getData()); |
| 45 | - } else { |
|
| 45 | + } else{ |
|
| 46 | 46 | unset($requestData['requests'][$counter]['data']); |
| 47 | 47 | } |
| 48 | 48 | $requestData['requests'][$counter]['headers'] = $EntryPoint->getRequest()->getHeaders(); |
@@ -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 | } |
@@ -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); |
@@ -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); |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | |
| 10 | 10 | protected $default_message = 'Unknown SDK Exception occurred.'; |
| 11 | 11 | |
| 12 | - public function __construct($message = '') { |
|
| 12 | + public function __construct($message = ''){ |
|
| 13 | 13 | if (empty($message)){ |
| 14 | 14 | $message = $this->default_message; |
| 15 | 15 | } |