@@ -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; |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
4 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
5 | 5 | |
6 | 6 | try{ |
7 | - $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7700/',array('username' => 'admin','password'=>'asdf')); |
|
7 | + $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7700/', array('username' => 'admin', 'password'=>'asdf')); |
|
8 | 8 | $SugarAPI->login(); |
9 | 9 | |
10 | 10 | $Accounts = $SugarAPI->filterRecords('Accounts')->setData(array('max_num'=> 5)); |
@@ -22,17 +22,17 @@ |
||
22 | 22 | echo "<h3>Requests Completed</h3><pre>"; |
23 | 23 | print_r($response->getBody()); |
24 | 24 | echo "</pre>"; |
25 | - }else{ |
|
25 | + } else{ |
|
26 | 26 | echo "<h3>Request Failed</h3><pre>"; |
27 | 27 | print_r($response); |
28 | 28 | echo "</pre>"; |
29 | 29 | } |
30 | 30 | |
31 | -}catch (\SugarAPI\SDK\Exception\Authentication\AuthenticationException $ex){ |
|
31 | +} catch (\SugarAPI\SDK\Exception\Authentication\AuthenticationException $ex){ |
|
32 | 32 | echo "Credentials:<pre>"; |
33 | 33 | print_r($SugarAPI->getCredentials()); |
34 | 34 | echo "</pre> Error Message: "; |
35 | 35 | print $ex->getMessage(); |
36 | -}catch (\SugarAPI\SDK\Exception\SDKException $ex){ |
|
36 | +} catch (\SugarAPI\SDK\Exception\SDKException $ex){ |
|
37 | 37 | echo $ex->__toString(); |
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | require_once __DIR__.'/../vendor/autoload.php'; |
4 | 4 | |
5 | -try { |
|
5 | +try{ |
|
6 | 6 | $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Ent/7621/', array( |
7 | 7 | 'username' => 'admin', |
8 | 8 | 'password' => 'asdf' |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | 'username' => 'admin', |
19 | 19 | 'password' => 'asdf' |
20 | 20 | )); |
21 | - if ($SugarAPI2->authenticated()) { |
|
21 | + if ($SugarAPI2->authenticated()){ |
|
22 | 22 | echo "Authenticated!"; |
23 | 23 | print_r($SugarAPI2->getToken()); |
24 | 24 | } |
25 | -} catch(\SugarAPI\SDK\Exception\SDKException $ex){ |
|
25 | +}catch (\SugarAPI\SDK\Exception\SDKException $ex){ |
|
26 | 26 | print_r($ex->getMessage()); |
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | require_once __DIR__.'/../vendor/autoload.php'; |
4 | 4 | |
5 | -try { |
|
5 | +try{ |
|
6 | 6 | $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Ent/7621/', array( |
7 | 7 | 'username' => 'admin', |
8 | 8 | 'password' => 'asdf' |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | 'username' => 'admin', |
19 | 19 | 'password' => 'asdf' |
20 | 20 | )); |
21 | - if ($SugarAPI2->authenticated()) { |
|
21 | + if ($SugarAPI2->authenticated()){ |
|
22 | 22 | echo "Authenticated!"; |
23 | 23 | print_r($SugarAPI2->getToken()); |
24 | 24 | } |
@@ -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; |
@@ -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; |