Passed
Push — master ( 945dc8...ec757f )
by Mike
02:50
created
src/Helpers/Helpers.php 1 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.
src/Request/Abstracts/AbstractRequest.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
     /**
91 91
      * Always make sure to destroy Curl Resource
92 92
      */
93
-    public function __destruct() {
93
+    public function __destruct(){
94 94
         if ($this->status!==self::STATUS_CLOSED){
95 95
             curl_close($this->CurlRequest);
96 96
         }
Please login to merge, or discard this patch.
src/EntryPoint/Abstracts/AbstractEntryPoint.php 1 patch
Braces   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     public function __construct($baseUrl,array $options = array()){
120 120
         $this->baseUrl = $baseUrl;
121 121
 
122
-        if (!empty($options)) {
122
+        if (!empty($options)){
123 123
             $this->setOptions($options);
124 124
         }
125 125
         $this->configureURL();
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     /**
147 147
      * @inheritdoc
148 148
      */
149
-    public function setAuth($accessToken) {
149
+    public function setAuth($accessToken){
150 150
         $this->accessToken = $accessToken;
151 151
         return $this;
152 152
     }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     /**
155 155
      * @inheritdoc
156 156
      */
157
-    public function setUrl($url) {
157
+    public function setUrl($url){
158 158
         $this->Url = $url;
159 159
         return $this;
160 160
     }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     /**
163 163
      * @inheritdoc
164 164
      */
165
-    public function setRequest(RequestInterface $Request) {
165
+    public function setRequest(RequestInterface $Request){
166 166
         $this->Request = $Request;
167 167
         return $this;
168 168
     }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     /**
171 171
      * @inheritdoc
172 172
      */
173
-    public function setResponse(ResponseInterface $Response) {
173
+    public function setResponse(ResponseInterface $Response){
174 174
         $this->Response = $Response;
175 175
         return $this;
176 176
     }
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
     public function execute($data = NULL){
221 221
         $data =  ($data === NULL?$this->Data:$data);
222 222
         $this->configureData($data);
223
-        if (is_object($this->Request)) {
223
+        if (is_object($this->Request)){
224 224
             $this->configureRequest();
225 225
             $this->Request->send();
226
-        }else{
226
+        } else{
227 227
             throw new InvalidRequestException(get_called_class(),"Request property not configured");
228 228
         }
229 229
         return $this;
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
     /**
233 233
      * @inheritdoc
234 234
      */
235
-    public function authRequired() {
235
+    public function authRequired(){
236 236
         return $this->_AUTH_REQUIRED;
237 237
     }
238 238
 
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
      * @throws RequiredDataException
243 243
      */
244 244
     protected function configureRequest(){
245
-        if ($this->verifyUrl()) {
245
+        if ($this->verifyUrl()){
246 246
             $this->Request->setURL($this->Url);
247 247
         }
248
-        if ($this->verifyData() && !empty($this->Data)) {
248
+        if ($this->verifyData() && !empty($this->Data)){
249 249
             $this->Request->setBody($this->Data);
250 250
         }
251 251
         $this->configureAuth();
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
      * Configures the authentication header on the Request object
256 256
      */
257 257
     protected function configureAuth(){
258
-        if ($this->authRequired()) {
258
+        if ($this->authRequired()){
259 259
             $this->Request->addHeader('OAuth-Token', $this->accessToken);
260 260
         }
261 261
     }
@@ -292,12 +292,12 @@  discard block
 block discarded – undo
292 292
      */
293 293
     protected function configureURL(){
294 294
         $url = $this->_URL;
295
-        if ($this->requiresOptions()) {
295
+        if ($this->requiresOptions()){
296 296
             $urlParts = explode("/", $this->_URL);
297 297
             $o = 0;
298
-            foreach ($urlParts as $key => $part) {
299
-                if (strpos($part, "$") !== FALSE) {
300
-                    if (isset($this->Options[$o])) {
298
+            foreach ($urlParts as $key => $part){
299
+                if (strpos($part, "$") !== FALSE){
300
+                    if (isset($this->Options[$o])){
301 301
                         $urlParts[$key] = $this->Options[$o];
302 302
                         $o++;
303 303
                     }
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
      * @throws RequiredDataException
329 329
      */
330 330
     protected function verifyData(){
331
-        if (isset($this->_DATA_TYPE)||!empty($this->_DATA_TYPE)) {
331
+        if (isset($this->_DATA_TYPE)||!empty($this->_DATA_TYPE)){
332 332
             $this->verifyDataType();
333 333
         }
334 334
         if (!empty($this->_REQUIRED_DATA)){
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
      * @throws RequiredDataException
344 344
      */
345 345
     protected function verifyDataType(){
346
-        if (gettype($this->Data) !== $this->_DATA_TYPE) {
346
+        if (gettype($this->Data) !== $this->_DATA_TYPE){
347 347
             throw new RequiredDataException(get_called_class(),"Valid DataType is {$this->_DATA_TYPE}");
348 348
         }
349 349
         return true;
Please login to merge, or discard this patch.
src/EntryPoint/POST/ModuleRecordFileField.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,13 +32,13 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/EntryPoint/POST/Bulk.php 1 patch
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,19 +30,19 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/Response/File.php 1 patch
Braces   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
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();
@@ -59,8 +59,7 @@  discard block
 block discarded – undo
59 59
      * Extract the filename from the Headers, and store it in filename property
60 60
      */
61 61
     protected function extractFileName(){
62
-        foreach (explode("\r\n", $this->headers) as $header)
63
-        {
62
+        foreach (explode("\r\n", $this->headers) as $header){
64 63
             if (strpos($header, 'filename')!==FALSE){
65 64
                 $this->setFileName(substr($header, (strpos($header, "\"")+1), -1));
66 65
             }
@@ -99,7 +98,7 @@  discard block
 block discarded – undo
99 98
             fwrite($fileHandle,$this->body);
100 99
             fclose($fileHandle);
101 100
             return $file;
102
-        }else{
101
+        } else{
103 102
             return FALSE;
104 103
         }
105 104
     }
Please login to merge, or discard this patch.
src/Response/Abstracts/AbstractResponse.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
         }
53 53
     }
54 54
 
55
-    public function setCurlResponse($curlResponse) {
55
+    public function setCurlResponse($curlResponse){
56 56
         $this->extractInfo();
57 57
         if (!$this->getError()){
58 58
             $this->extractResponse($curlResponse);
Please login to merge, or discard this patch.
src/EntryPoint/Abstracts/PUT/AbstractPutEntryPoint.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/EntryPoint/Abstracts/GET/AbstractGetEntryPoint.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.