Test Failed
Push — master ( d9b525...db8114 )
by Mike
02:47
created
src/Exception/SDKException.php 1 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
 class EntryPointException extends SDKException {
6 6
 
7
-    public function __construct($message) {
7
+    public function __construct($message){
8 8
         parent::__construct($message);
9 9
     }
10 10
 
Please login to merge, or discard this patch.
src/Client/Abstracts/AbstractClient.php 1 patch
Braces   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     protected $entryPoints = array();
62 62
 
63 63
     public function __construct($server = '',array $credentials = array()){
64
-        if (!empty($server)) {
64
+        if (!empty($server)){
65 65
             $this->setServer($server);
66 66
         }
67 67
         if (!empty($credentials)){
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     /**
74 74
      * @inheritdoc
75 75
      */
76
-    public function setServer($server) {
76
+    public function setServer($server){
77 77
         $this->server = $server;
78 78
         $this->apiURL = Helpers::configureAPIURL($this->server);
79 79
         return $this;
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     /**
83 83
      * @inheritdoc
84 84
      */
85
-    public function getAPIUrl() {
85
+    public function getAPIUrl(){
86 86
         return $this->apiURL;
87 87
     }
88 88
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     /**
126 126
      * @inheritdoc
127 127
      */
128
-    public function getServer() {
128
+    public function getServer(){
129 129
         return $this->server;
130 130
     }
131 131
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         $implements = class_implements($className);
158 158
         if (is_array($implements) && in_array('SugarAPI\SDK\EntryPoint\Interfaces\EPInterface',$implements)){
159 159
             $this->entryPoints[$funcName] = $className;
160
-        }else{
160
+        } else{
161 161
             throw new EntryPointException($className,'Class must extend SugarAPI\SDK\EntryPoint\Interfaces\EPInterface');
162 162
         }
163 163
         return $this;
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
             $EntryPoint = new $Class($this->apiURL, $params);
177 177
 
178 178
             if ($EntryPoint->authRequired()){
179
-                if (isset($this->token) && $this->authenticated()) {
179
+                if (isset($this->token) && $this->authenticated()){
180 180
                     $EntryPoint->setAuth($this->getToken()->access_token);
181 181
                 }
182 182
             }
183 183
             return $EntryPoint;
184
-        }else{
184
+        } else{
185 185
             throw new EntryPointException($name,'Unregistered EntryPoint');
186 186
         }
187 187
     }
@@ -190,13 +190,13 @@  discard block
 block discarded – undo
190 190
      * @inheritdoc
191 191
      * @throws AuthenticationException - When Login request fails
192 192
      */
193
-    public function login() {
193
+    public function login(){
194 194
         $EP = new OAuth2Token($this->apiURL);
195 195
         $response = $EP->execute($this->credentials)->getResponse();
196 196
         if ($response->getStatus()=='200'){
197 197
             $this->setToken($response->getBody(false));
198 198
             static::storeToken($this->token,$this->credentials['client_id']);
199
-        } else {
199
+        } else{
200 200
             $error = $response->getBody();
201 201
             throw new AuthenticationException("Login Response [".$error['error']."] ".$error['error_message']);
202 202
         }
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
         if ($response->getStatus()=='200'){
219 219
             $this->setToken($response->getBody(false));
220 220
             static::storeToken($this->token,$this->credentials['client_id']);
221
-        }else{
221
+        } else{
222 222
             $error = $response->getBody();
223 223
             throw new AuthenticationException("Refresh Response [".$error['error']."] ".$error['error_message']);
224 224
         }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
             if ($response->getStatus()=='200'){
237 237
                 unset($this->token);
238 238
                 static::removeStoredToken($this->credentials['client_id']);
239
-            }else{
239
+            } else{
240 240
                 $error = $response->getBody();
241 241
                 throw new AuthenticationException("Logout Response [".$error['error']."] ".$error['message']);
242 242
             }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
     /**
248 248
      * @inheritdoc
249 249
      */
250
-    public static function storeToken($token, $client_id) {
250
+    public static function storeToken($token, $client_id){
251 251
         static::$_STORED_TOKENS[$client_id] = $token;
252 252
         return true;
253 253
     }
@@ -255,14 +255,14 @@  discard block
 block discarded – undo
255 255
     /**
256 256
      * @inheritdoc
257 257
      */
258
-    public static function getStoredToken($client_id) {
258
+    public static function getStoredToken($client_id){
259 259
         return static::$_STORED_TOKENS[$client_id];
260 260
     }
261 261
 
262 262
     /**
263 263
      * @inheritdoc
264 264
      */
265
-    public static function removeStoredToken($client_id) {
265
+    public static function removeStoredToken($client_id){
266 266
         unset(static::$_STORED_TOKENS[$client_id]);
267 267
         return true;
268 268
     }
Please login to merge, or discard this patch.
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/EntryPoint/Abstracts/PUT/AbstractPutEntryPoint.php 1 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.
src/EntryPoint/Abstracts/GET/AbstractGetEntryPoint.php 1 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.
src/EntryPoint/Abstracts/POST/AbstractPostEntryPoint.php 1 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.
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/DELETE/AbstractDeleteEntryPoint.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,12 +9,12 @@
 block discarded – undo
9 9
 
10 10
 abstract class AbstractDeleteEntryPoint extends AbstractEntryPoint {
11 11
 
12
-    public function __construct($url, array $options = array()) {
12
+    public function __construct($url, array $options = array()){
13 13
         $this->setRequest(new DELETE());
14 14
         parent::__construct($url, $options);
15 15
     }
16 16
 
17
-    public function execute($data = NULL) {
17
+    public function execute($data = NULL){
18 18
         parent::execute($data);
19 19
         $this->setResponse(new JSON($this->Request->getResponse(),$this->Request->getCurlObject()));
20 20
         return $this;
Please login to merge, or discard this patch.
src/Response/File.php 1 patch
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,8 +45,7 @@  discard block
 block discarded – undo
45 45
      * Extract the filename from the Headers, and store it in filename property
46 46
      */
47 47
     protected function extractFileName(){
48
-        foreach (explode("\r\n", $this->headers) as $header)
49
-        {
48
+        foreach (explode("\r\n", $this->headers) as $header){
50 49
             if (strpos($header, 'filename')!==FALSE){
51 50
                 $this->fileName = substr($header, (strpos($header, "\"")+1), -1);
52 51
             }
@@ -72,7 +71,7 @@  discard block
 block discarded – undo
72 71
             fwrite($fileHandle,$this->body);
73 72
             fclose($fileHandle);
74 73
             return $file;
75
-        }else{
74
+        } else{
76 75
             return FALSE;
77 76
         }
78 77
     }
Please login to merge, or discard this patch.