@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param $EntryPoint - EPInterface Class Name |
32 | 32 | * @return $this |
33 | 33 | */ |
34 | - public function registerEntryPoint($function,$EntryPoint); |
|
34 | + public function registerEntryPoint($function, $EntryPoint); |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * Login to the configured SugarCRM server |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param $client_id |
58 | 58 | * @return boolean |
59 | 59 | */ |
60 | - public static function storeToken($token,$client_id); |
|
60 | + public static function storeToken($token, $client_id); |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * Get an SDK Clients authentication Token from Storage |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | * @return string |
16 | 16 | */ |
17 | 17 | public static function configureAPIURL($instance){ |
18 | - if (strpos($instance,"http")===FALSE){ |
|
18 | + if (strpos($instance, "http")===FALSE){ |
|
19 | 19 | $instance = "http://".$instance; |
20 | 20 | } |
21 | - if (strpos($instance,"rest/v10")!==FALSE){ |
|
21 | + if (strpos($instance, "rest/v10")!==FALSE){ |
|
22 | 22 | $instance = str_replace("rest/v10", "", $instance); |
23 | 23 | } |
24 | 24 | return rtrim($instance, "/").self::API_URL; |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | public static function getSDKEntryPointRegistry(){ |
40 | 40 | $entryPoints = array(); |
41 | 41 | require __DIR__.DIRECTORY_SEPARATOR.'registry.php'; |
42 | - foreach ($entryPoints as $funcName => $className) { |
|
43 | - $className = "SugarAPI\\SDK\\EntryPoint\\" . $className; |
|
42 | + foreach ($entryPoints as $funcName => $className){ |
|
43 | + $className = "SugarAPI\\SDK\\EntryPoint\\".$className; |
|
44 | 44 | $entryPoints[$funcName] = $className; |
45 | 45 | } |
46 | 46 | return $entryPoints; |
@@ -32,19 +32,19 @@ |
||
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 | } |
45 | 45 | if (is_array($data)){ |
46 | 46 | foreach ($data as $key => $value){ |
47 | - if (!array_key_exists($key,$this->_REQUIRED_DATA)){ |
|
47 | + if (!array_key_exists($key, $this->_REQUIRED_DATA)){ |
|
48 | 48 | $data[$key] = $this->setFileFieldValue($value); |
49 | 49 | } |
50 | 50 | } |
@@ -30,23 +30,23 @@ |
||
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(); |
49 | - $requestData['requests'][$counter]['url'] = "v10/" . str_replace($this->baseUrl, "", $EntryPoint->getUrl()); |
|
49 | + $requestData['requests'][$counter]['url'] = "v10/".str_replace($this->baseUrl, "", $EntryPoint->getUrl()); |
|
50 | 50 | |
51 | 51 | $counter++; |
52 | 52 | } |
@@ -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{ |
@@ -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); |