Completed
Push — master ( fd48c6...d6eea8 )
by Mike
02:42
created
src/Request/Interfaces/RequestInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      * @param $value - Header Value
24 24
      * @return SugarAPI\SDK\Request Object
25 25
      */
26
-    public function addHeader($name,$value);
26
+    public function addHeader($name, $value);
27 27
 
28 28
     /**
29 29
      * Sets the Headers on the Curl Request object, called during Sending. Appends to Request Headers property
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      * @param $value - Curl Option Value
51 51
      * @return SugarAPI\SDK\Request Object
52 52
      */
53
-    public function setOption($option,$value);
53
+    public function setOption($option, $value);
54 54
 
55 55
     /**
56 56
      * Set the URL on the Request Object
Please login to merge, or discard this patch.
examples/Login.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once __DIR__ . '/../vendor/autoload.php';
3
+require_once __DIR__.'/../vendor/autoload.php';
4 4
 
5
-$SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Ent/7621/',array('username' => 'admin','password'=>'asdf'));
5
+$SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Ent/7621/', array('username' => 'admin', 'password'=>'asdf'));
6 6
 $SugarAPI->login();
7 7
 print_r($SugarAPI->getToken());
8 8
\ No newline at end of file
Please login to merge, or discard this patch.
src/EntryPoint/GET/RecordFileField.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 use SugarAPI\SDK\EntryPoint\Abstracts\GET\FileEntryPoint as GETFileEntryPoint;
6 6
 
7
-class RecordFileField extends GETFileEntryPoint{
7
+class RecordFileField extends GETFileEntryPoint {
8 8
 
9 9
     protected $_URL = '$module/$record/file/$field';
10 10
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 use SugarAPI\SDK\EntryPoint\Abstracts\GET\FileEntryPoint as GETFileEntryPoint;
6 6
 
7
-class RecordFileField extends GETFileEntryPoint{
7
+class RecordFileField extends GETFileEntryPoint {
8 8
 
9 9
     /**
10 10
      * @inheritdoc
Please login to merge, or discard this patch.
src/EntryPoint/POST/CreateRecord.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 use SugarAPI\SDK\EntryPoint\Abstracts\POST\JSONEntryPoint as POSTEntryPoint;
6 6
 
7
-class CreateRecord extends POSTEntryPoint{
7
+class CreateRecord extends POSTEntryPoint {
8 8
 
9 9
     protected $_URL = '$module';
10 10
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 use SugarAPI\SDK\EntryPoint\Abstracts\POST\JSONEntryPoint as POSTEntryPoint;
6 6
 
7
-class CreateRecord extends POSTEntryPoint{
7
+class CreateRecord extends POSTEntryPoint {
8 8
 
9 9
     protected $_URL = '$module';
10 10
 
Please login to merge, or discard this patch.
examples/FavoriteRecord.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 
13 13
     print_r($response);
14 14
 
15
-}catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){
15
+} catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){
16 16
     print $ex->getMessage();
17 17
 }
18 18
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once __DIR__ . '/../vendor/autoload.php';
3
+require_once __DIR__.'/../vendor/autoload.php';
4 4
 
5 5
 $record_id = 'a887c75b-b89a-852e-8e67-56f1ccdee355';
6 6
 
7 7
 try{
8
-    $SugarAPI = new \SugarAPI\SDK\SugarAPI('localhost/ent77',array('username' => 'admin','password'=>'admin123'));
8
+    $SugarAPI = new \SugarAPI\SDK\SugarAPI('localhost/ent77', array('username' => 'admin', 'password'=>'admin123'));
9 9
     $SugarAPI->login();
10
-    $EP = $SugarAPI->favorite('Accounts',$record_id);
10
+    $EP = $SugarAPI->favorite('Accounts', $record_id);
11 11
     $response = $EP->execute()->getResponse()->getBody();
12 12
 
13 13
     print_r($response);
14 14
 
15
-}catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){
15
+}catch (\SugarAPI\SDK\Exception\AuthenticationException $ex){
16 16
     print $ex->getMessage();
17 17
 }
18 18
 
Please login to merge, or discard this patch.
examples/UploadFile.php 2 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,18 +21,18 @@
 block discarded – undo
21 21
         if ($response->getStatus()=='200'){
22 22
             $record = $response->getBody();
23 23
             print_r($response);
24
-        }else{
24
+        } else{
25 25
             print_r($upload->getRequest());
26 26
             echo "Failed to Update Note with File<br>";
27 27
             echo "Response: ".$response->getStatus()."<br>";
28 28
             print_r($response->getBody());
29 29
         }
30
-    }else{
30
+    } else{
31 31
         echo "Failed to create Note<br>";
32 32
         echo "Response: ".$response->getStatus()."<br>";
33 33
         print_r($response->getBody());
34 34
     }
35 35
 
36
-}catch(\SugarAPI\SDK\Exception\SDKException $ex){
36
+} catch(\SugarAPI\SDK\Exception\SDKException $ex){
37 37
     print $ex->getMessage();
38 38
 }
39 39
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once __DIR__ . '/../vendor/autoload.php';
3
+require_once __DIR__.'/../vendor/autoload.php';
4 4
 
5 5
 try{
6
-    $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Ent/7700/',array('username' => 'admin','password'=>'asdf'));
6
+    $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Ent/7700/', array('username' => 'admin', 'password'=>'asdf'));
7 7
     $SugarAPI->login();
8 8
     $EP = $SugarAPI->createRecord('Notes')->data(array('name' => 'Test Note'))->execute();
9 9
     $response = $EP->getResponse();
10 10
     if ($response->getStatus()=='200'){
11 11
         $record = $response->getBody();
12 12
 
13
-        $upload = $SugarAPI->attachFile('Notes',$record->id,'filename')->data(__DIR__.'/testfile.txt;filename=testfile.txt')->execute();
13
+        $upload = $SugarAPI->attachFile('Notes', $record->id, 'filename')->data(__DIR__.'/testfile.txt;filename=testfile.txt')->execute();
14 14
         $response = $upload->getResponse();
15 15
         if ($response->getStatus()=='200'){
16 16
             $record = $response->getBody();
@@ -27,6 +27,6 @@  discard block
 block discarded – undo
27 27
         print_r($response->getBody());
28 28
     }
29 29
 
30
-}catch(\SugarAPI\SDK\Exception\SDKException $ex){
30
+}catch (\SugarAPI\SDK\Exception\SDKException $ex){
31 31
     print $ex->getMessage();
32 32
 }
33 33
\ No newline at end of file
Please login to merge, or discard this patch.
examples/CRUD.php 2 patches
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -39,31 +39,31 @@
 block discarded – undo
39 39
                     $response = $deleteRecord->getResponse()->getBody();
40 40
                     echo "Deleted Record <br>";
41 41
                     print_r($response);
42
-                }else{
42
+                } else{
43 43
                     echo "Failed to Delete record<br>";
44 44
                     echo "Response: ".$response->getStatus()."<br>";
45 45
                     print_r($response->getBody());
46 46
                 }
47
-            }else{
47
+            } else{
48 48
                 print_r($updateRecord->getRequest());
49 49
                 echo "Failed to Update record<br>";
50 50
                 echo "Response: ".$response->getStatus()."<br>";
51 51
                 print_r($response->getBody());
52 52
             }
53
-        }else{
53
+        } else{
54 54
             echo "Failed to retrieve record<br>";
55 55
             echo "Response: ".$response->getStatus()."<br>";
56 56
             print_r($response->getBody());
57 57
         }
58
-    }else{
58
+    } else{
59 59
         echo "Response: ".$response->getStatus();
60 60
         print_r($response->getBody());
61 61
     }
62
-}catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){
62
+} catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){
63 63
     echo "Auth Options:<pre>";
64 64
     print_r($SugarAPI->getAuthOptions());
65 65
     echo "</pre> Error Message: ";
66 66
     print $ex->getMessage();
67
-}catch(\SugarAPI\SDK\Exception\SDKException $ex){
67
+} catch(\SugarAPI\SDK\Exception\SDKException $ex){
68 68
     echo $ex->__toString();
69 69
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 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();
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)->data(array(
19
+        $getRecord = $SugarAPI->getRecord('Accounts', $randomRecord->id)->data(array(
20 20
             'fields' => 'name'
21 21
         ))->execute();
22 22
         $response = $getRecord->getResponse();
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
             echo "Retrieved Record <br>";
25 25
             $randomRecord = $getRecord->getResponse()->getBody();
26 26
             $randomRecord->name = 'Updated Record Name';
27
-            $updateRecord = $SugarAPI->updateRecord('Accounts',$randomRecord->id)->data($randomRecord)->execute();
27
+            $updateRecord = $SugarAPI->updateRecord('Accounts', $randomRecord->id)->data($randomRecord)->execute();
28 28
             $response = $updateRecord->getResponse();
29 29
             if ($response->getStatus()=='200'){
30 30
                 $randomRecord = $updateRecord->getResponse()->getBody();
31 31
                 echo "Updated Record <br>";
32 32
                 print_r($randomRecord);
33 33
 
34
-                $deleteRecord = $SugarAPI->deleteRecord('Accounts',$randomRecord->id)->execute();
34
+                $deleteRecord = $SugarAPI->deleteRecord('Accounts', $randomRecord->id)->execute();
35 35
                 $response = $deleteRecord->getResponse();
36 36
                 if ($response->getStatus()=='200'){
37 37
                     $response = $deleteRecord->getResponse()->getBody();
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
         echo "Response: ".$response->getStatus();
58 58
         print_r($response->getBody());
59 59
     }
60
-}catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){
60
+}catch (\SugarAPI\SDK\Exception\AuthenticationException $ex){
61 61
     echo "Auth Options:<pre>";
62 62
     print_r($SugarAPI->getAuthOptions());
63 63
     echo "</pre> Error Message: ";
64 64
     print $ex->getMessage();
65
-}catch(\SugarAPI\SDK\Exception\SDKException $ex){
65
+}catch (\SugarAPI\SDK\Exception\SDKException $ex){
66 66
     echo $ex->__toString();
67 67
 }
Please login to merge, or discard this patch.
examples/CreateRecord.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,6 +19,6 @@
 block discarded – undo
19 19
         print_r($getResponse->getBody());
20 20
     }
21 21
 
22
-}catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){
22
+} catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){
23 23
     print $ex->getMessage();
24 24
 }
25 25
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once __DIR__ . '/../vendor/autoload.php';
3
+require_once __DIR__.'/../vendor/autoload.php';
4 4
 
5 5
 try{
6
-    $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7621/',array('username' => 'admin','password'=>'asdf'));
6
+    $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7621/', array('username' => 'admin', 'password'=>'asdf'));
7 7
     $SugarAPI->login();
8 8
     $EP = $SugarAPI->createRecord('Accounts');
9 9
     $EP->data(array(
@@ -13,12 +13,12 @@  discard block
 block discarded – undo
13 13
     $response = $EP->execute()->getResponse();
14 14
     if ($response->getStatus()=='200'){
15 15
         $record = $response->getBody();
16
-        $EP2 = $SugarAPI->getRecord('Accounts',$record->id)->data(array('fields' => 'name,email1'));
16
+        $EP2 = $SugarAPI->getRecord('Accounts', $record->id)->data(array('fields' => 'name,email1'));
17 17
         $getResponse = $EP2->execute()->getResponse();
18 18
         print $EP2->getUrl();
19 19
         print_r($getResponse->getBody());
20 20
     }
21 21
 
22
-}catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){
22
+}catch (\SugarAPI\SDK\Exception\AuthenticationException $ex){
23 23
     print $ex->getMessage();
24 24
 }
25 25
\ No newline at end of file
Please login to merge, or discard this patch.
examples/GetFile.php 2 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@
 block discarded – undo
14 14
             echo "File downloaded to ".$response->file();
15 15
         }
16 16
 
17
-    }else{
17
+    } else{
18 18
         echo "Failed to retrieve Note<br>";
19 19
         echo "Response: ".$response->getStatus()."<br>";
20 20
         print_r($response->getBody());
21 21
     }
22 22
 
23
-}catch(\SugarAPI\SDK\Exception\SDKException $ex){
23
+} catch(\SugarAPI\SDK\Exception\SDKException $ex){
24 24
     print $ex->getMessage();
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once __DIR__ . '/../vendor/autoload.php';
3
+require_once __DIR__.'/../vendor/autoload.php';
4 4
 
5 5
 $recordID = 'ac096703-67fd-8dd2-980a-57097932f07a';
6 6
 
7 7
 try{
8
-    $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Ent/7700/',array('username' => 'admin','password'=>'asdf'));
8
+    $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Ent/7700/', array('username' => 'admin', 'password'=>'asdf'));
9 9
     $SugarAPI->login();
10
-    $EP = $SugarAPI->getAttachment('Notes',$recordID,'filename')->downloadTo(__DIR__)->execute();
10
+    $EP = $SugarAPI->getAttachment('Notes', $recordID, 'filename')->downloadTo(__DIR__)->execute();
11 11
     $response = $EP->getResponse();
12 12
     if ($response->getStatus()=='200'){
13 13
         if (file_exists($response->file())){
@@ -20,6 +20,6 @@  discard block
 block discarded – undo
20 20
         print_r($response->getBody());
21 21
     }
22 22
 
23
-}catch(\SugarAPI\SDK\Exception\SDKException $ex){
23
+}catch (\SugarAPI\SDK\Exception\SDKException $ex){
24 24
     print $ex->getMessage();
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.