@@ -8,14 +8,14 @@ |
||
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 | - $this->setResponse(new JSON($this->Request->getResponse(),$this->Request->getCurlObject())); |
|
18 | + $this->setResponse(new JSON($this->Request->getResponse(), $this->Request->getCurlObject())); |
|
19 | 19 | return $this; |
20 | 20 | } |
21 | 21 |
@@ -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; |
@@ -13,7 +13,7 @@ |
||
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; |
@@ -47,7 +47,7 @@ |
||
47 | 47 | $data[$fileField] = $this->setFileFieldValue($data[$fileField]); |
48 | 48 | }else{ |
49 | 49 | foreach ($this->Data as $key => $value){ |
50 | - if (!array_key_exists($key,$this->_REQUIRED_DATA)){ |
|
50 | + if (!array_key_exists($key, $this->_REQUIRED_DATA)){ |
|
51 | 51 | $data[$key] = $this->setFileFieldValue($value); |
52 | 52 | } |
53 | 53 | } |
@@ -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); |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | protected $_REQUIRED_DATA = array( |
24 | 24 | 'format' => 'sugar-html-json', |
25 | - 'delete_if_fails' => false |
|
25 | + 'delete_if_fails' => FALSE |
|
26 | 26 | ); |
27 | 27 | |
28 | 28 | /** |
@@ -6,15 +6,15 @@ |
||
6 | 6 | |
7 | 7 | class OAuth2Token extends AbstractPostEntryPoint { |
8 | 8 | |
9 | - protected $_AUTH_REQUIRED = false; |
|
9 | + protected $_AUTH_REQUIRED = FALSE; |
|
10 | 10 | protected $_URL = 'oauth2/token'; |
11 | 11 | protected $_REQUIRED_DATA = array( |
12 | - 'username' => null, |
|
13 | - 'password' => null, |
|
12 | + 'username' => NULL, |
|
13 | + 'password' => NULL, |
|
14 | 14 | 'grant_type' => 'password', |
15 | - 'client_id' => null, |
|
16 | - 'client_secret' => null, |
|
17 | - 'platform' => null |
|
15 | + 'client_id' => NULL, |
|
16 | + 'client_secret' => NULL, |
|
17 | + 'platform' => NULL |
|
18 | 18 | ); |
19 | 19 | protected $_DATA_TYPE = 'array'; |
20 | 20 |
@@ -9,9 +9,9 @@ |
||
9 | 9 | */ |
10 | 10 | protected $_REQUIRED_DATA = array( |
11 | 11 | 'grant_type' => 'refresh_token', |
12 | - 'refresh_token' => null, |
|
13 | - 'client_id' => null, |
|
14 | - 'client_secret' => null |
|
12 | + 'refresh_token' => NULL, |
|
13 | + 'client_id' => NULL, |
|
14 | + 'client_secret' => NULL |
|
15 | 15 | ); |
16 | 16 | |
17 | 17 | } |
18 | 18 | \ No newline at end of file |
@@ -30,22 +30,22 @@ |
||
30 | 30 | 'method' => '' |
31 | 31 | ); |
32 | 32 | |
33 | - protected function configureData($data) { |
|
33 | + protected function configureData($data){ |
|
34 | 34 | $requestData = array( |
35 | 35 | 'requests' => array() |
36 | 36 | ); |
37 | 37 | $counter = 0; |
38 | - foreach($data as $key => $EntryPoint){ |
|
39 | - if (is_object($EntryPoint)) { |
|
38 | + foreach ($data as $key => $EntryPoint){ |
|
39 | + if (is_object($EntryPoint)){ |
|
40 | 40 | $requestData['requests'][$counter] = $this->bulkRequest; |
41 | 41 | $requestData['requests'][$counter]['method'] = $EntryPoint->getRequest()->getType(); |
42 | - if ($requestData['requests'][$counter]['method'] == "POST" || $requestData['requests'][$counter]['method'] == "PUT") { |
|
42 | + if ($requestData['requests'][$counter]['method']=="POST" || $requestData['requests'][$counter]['method']=="PUT"){ |
|
43 | 43 | $requestData['requests'][$counter]['data'] = $EntryPoint->getRequest()->getBody(); |
44 | - } else { |
|
44 | + }else{ |
|
45 | 45 | unset($requestData['requests'][$counter]['data']); |
46 | 46 | } |
47 | 47 | $requestData['requests'][$counter]['headers'] = $EntryPoint->getRequest()->getHeaders(); |
48 | - $requestData['requests'][$counter]['url'] = "v10/" . str_replace($this->baseUrl, "", $EntryPoint->getUrl()); |
|
48 | + $requestData['requests'][$counter]['url'] = "v10/".str_replace($this->baseUrl, "", $EntryPoint->getUrl()); |
|
49 | 49 | |
50 | 50 | $counter++; |
51 | 51 | } |
@@ -30,18 +30,18 @@ |
||
30 | 30 | 'method' => '' |
31 | 31 | ); |
32 | 32 | |
33 | - protected function configureData($data) { |
|
33 | + protected function configureData($data){ |
|
34 | 34 | $requestData = array( |
35 | 35 | 'requests' => array() |
36 | 36 | ); |
37 | 37 | $counter = 0; |
38 | 38 | foreach($data as $key => $EntryPoint){ |
39 | - if (is_object($EntryPoint)) { |
|
39 | + if (is_object($EntryPoint)){ |
|
40 | 40 | $requestData['requests'][$counter] = $this->bulkRequest; |
41 | 41 | $requestData['requests'][$counter]['method'] = $EntryPoint->getRequest()->getType(); |
42 | - if ($requestData['requests'][$counter]['method'] == "POST" || $requestData['requests'][$counter]['method'] == "PUT") { |
|
42 | + if ($requestData['requests'][$counter]['method'] == "POST" || $requestData['requests'][$counter]['method'] == "PUT"){ |
|
43 | 43 | $requestData['requests'][$counter]['data'] = $EntryPoint->getRequest()->getBody(); |
44 | - } else { |
|
44 | + } else{ |
|
45 | 45 | unset($requestData['requests'][$counter]['data']); |
46 | 46 | } |
47 | 47 | $requestData['requests'][$counter]['headers'] = $EntryPoint->getRequest()->getHeaders(); |
@@ -20,7 +20,7 @@ |
||
20 | 20 | * @inheritdoc |
21 | 21 | */ |
22 | 22 | protected $_REQUIRED_DATA = array( |
23 | - 'requests' => null |
|
23 | + 'requests' => NULL |
|
24 | 24 | ); |
25 | 25 | |
26 | 26 | private $bulkRequest = array( |
@@ -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 |
@@ -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 | } |
@@ -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; |
@@ -8,14 +8,14 @@ |
||
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 | - $this->setResponse(new JSON($this->Request->getResponse(),$this->Request->getCurlObject())); |
|
18 | + $this->setResponse(new JSON($this->Request->getResponse(), $this->Request->getCurlObject())); |
|
19 | 19 | return $this; |
20 | 20 | } |
21 | 21 |
@@ -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; |
@@ -13,7 +13,7 @@ |
||
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; |
@@ -8,14 +8,14 @@ |
||
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 | - $this->setResponse(new JSON($this->Request->getResponse(),$this->Request->getCurlObject())); |
|
18 | + $this->setResponse(new JSON($this->Request->getResponse(), $this->Request->getCurlObject())); |
|
19 | 19 | return $this; |
20 | 20 | } |
21 | 21 |
@@ -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; |
@@ -13,7 +13,7 @@ |
||
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; |