Completed
Push — master ( c7c88d...7873ee )
by Mike
02:24
created
src/EntryPoint/Abstracts/POST/AbstractPostEntryPoint.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@
 block discarded – undo
8 8
 
9 9
 abstract class AbstractPostEntryPoint 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 POST());
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
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@
 block discarded – undo
8 8
 
9 9
 abstract class AbstractPostEntryPoint 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 POST());
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;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/EntryPoint/Abstracts/POST/AbstractPostFileEntryPoint.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/EntryPoint/POST/ModuleRecordFileField.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
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
                 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
src/EntryPoint/POST/Oauth2Token.php 1 patch
Upper-Lower-Casing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/EntryPoint/POST/RefreshToken.php 1 patch
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/EntryPoint/POST/Bulk.php 3 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,22 +30,22 @@
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
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(
Please login to merge, or discard this patch.
src/Client/Interfaces/ClientInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Helpers/Helpers.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
examples/CRUD.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@
 block discarded – undo
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
     $EP = $SugarAPI->filterRecords('Accounts');
10 10
     $response = $EP->execute()->getResponse();
11 11
     if ($response->getStatus()=='200'){
12 12
         $recordList = $response->getBody(false);
13
-        $max=count($recordList->records);
13
+        $max = count($recordList->records);
14 14
         echo "found $max records from Filter Records request. <br>";
15
-        $number = rand(0,$max);
15
+        $number = rand(0, $max);
16 16
         $randomRecord = $recordList->records[$number];
17 17
         echo "Choose random record #$number, with ID: ".$randomRecord->id." <br>";
18 18
 
19
-        $getRecord = $SugarAPI->getRecord('Accounts',$randomRecord->id)->execute(array(
19
+        $getRecord = $SugarAPI->getRecord('Accounts', $randomRecord->id)->execute(array(
20 20
             'fields' => 'name'
21 21
         ));
22 22
         $response = $getRecord->getResponse();
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     $EP = $SugarAPI->filterRecords('Accounts');
10 10
     $response = $EP->execute()->getResponse();
11 11
     if ($response->getStatus()=='200'){
12
-        $recordList = $response->getBody(false);
12
+        $recordList = $response->getBody(FALSE);
13 13
         $max=count($recordList->records);
14 14
         echo "found $max records from Filter Records request. <br>";
15 15
         $number = rand(0,$max);
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
         $response = $getRecord->getResponse();
23 23
         if ($response->getStatus()=='200'){
24 24
             echo "Retrieved Record <br>";
25
-            $randomRecord = $getRecord->getResponse()->getBody(false);
25
+            $randomRecord = $getRecord->getResponse()->getBody(FALSE);
26 26
             $randomRecord->name = 'Updated Record Name';
27 27
             $updateRecord = $SugarAPI->updateRecord('Accounts', $randomRecord->id)->execute($randomRecord);
28 28
             $response = $updateRecord->getResponse();
29 29
             if ($response->getStatus()=='200'){
30
-                $randomRecord = $updateRecord->getResponse()->getBody(false);
30
+                $randomRecord = $updateRecord->getResponse()->getBody(FALSE);
31 31
                 echo "Updated Record <br>";
32 32
                 print_r($randomRecord);
33 33
 
Please login to merge, or discard this patch.