Passed
Push — master ( db8114...f9a48a )
by Mike
03:20
created
src/Request/Abstracts/AbstractRequest.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -133,6 +133,7 @@
 block discarded – undo
133 133
 
134 134
     /**
135 135
      * @inheritdoc
136
+     * @param string $body
136 137
      */
137 138
     public function setBody($body) {
138 139
         $this->body = $body;
Please login to merge, or discard this 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/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/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/Client/Abstracts/AbstractClient.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@
 block discarded – undo
151 151
     /**
152 152
      * @param $funcName
153 153
      * @param $className
154
-     * @return bool
154
+     * @return AbstractClient
155 155
      * @throws EntryPointException
156 156
      */
157 157
     public function registerEntryPoint($funcName, $className){
Please login to merge, or discard this patch.
Braces   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
     public function __construct($server = '',array $credentials = array()){
67 67
         $server = (empty($server)?$this->server:$server);
68
-        if (!empty($server)) {
68
+        if (!empty($server)){
69 69
             $this->setServer($server);
70 70
         }
71 71
         $credentials = (empty($credentials)?$this->credentials:$credentials);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      * @inheritdoc
80 80
      * @param string $server
81 81
      */
82
-    public function setServer($server) {
82
+    public function setServer($server){
83 83
         $this->server = $server;
84 84
         $this->apiURL = Helpers::configureAPIURL($this->server);
85 85
         return $this;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     /**
89 89
      * @inheritdoc
90 90
      */
91
-    public function getAPIUrl() {
91
+    public function getAPIUrl(){
92 92
         return $this->apiURL;
93 93
     }
94 94
 
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public function setCredentials(array $credentials){
100 100
         $this->credentials = $credentials;
101
-        if (isset($this->credentials['client_id'])) {
101
+        if (isset($this->credentials['client_id'])){
102 102
             $token = static::getStoredToken($this->credentials['client_id']);
103
-            if (!empty($token)) {
103
+            if (!empty($token)){
104 104
                 $this->setToken($token);
105 105
             }
106 106
         }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     /**
134 134
      * @inheritdoc
135 135
      */
136
-    public function getServer() {
136
+    public function getServer(){
137 137
         return $this->server;
138 138
     }
139 139
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
         $implements = class_implements($className);
166 166
         if (is_array($implements) && in_array('SugarAPI\SDK\EntryPoint\Interfaces\EPInterface',$implements)){
167 167
             $this->entryPoints[$funcName] = $className;
168
-        }else{
168
+        } else{
169 169
             throw new EntryPointException($className,'Class must extend SugarAPI\SDK\EntryPoint\Interfaces\EPInterface');
170 170
         }
171 171
         return $this;
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
             $EntryPoint = new $Class($this->apiURL, $params);
185 185
 
186 186
             if ($EntryPoint->authRequired()){
187
-                if (isset($this->token) && $this->authenticated()) {
187
+                if (isset($this->token) && $this->authenticated()){
188 188
                     $EntryPoint->setAuth($this->getToken()->access_token);
189 189
                 }
190 190
             }
191 191
             return $EntryPoint;
192
-        }else{
192
+        } else{
193 193
             throw new EntryPointException($name,'Unregistered EntryPoint');
194 194
         }
195 195
     }
@@ -198,13 +198,13 @@  discard block
 block discarded – undo
198 198
      * @inheritdoc
199 199
      * @throws AuthenticationException - When Login request fails
200 200
      */
201
-    public function login() {
201
+    public function login(){
202 202
         $EP = new OAuth2Token($this->apiURL);
203 203
         $response = $EP->execute($this->credentials)->getResponse();
204 204
         if ($response->getStatus()=='200'){
205 205
             $this->setToken($response->getBody(FALSE));
206 206
             static::storeToken($this->token,$this->credentials['client_id']);
207
-        } else {
207
+        } else{
208 208
             $error = $response->getBody();
209 209
             throw new AuthenticationException("Login Response [".$error['error']."] ".$error['error_message']);
210 210
         }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
         if ($response->getStatus()=='200'){
227 227
             $this->setToken($response->getBody(FALSE));
228 228
             static::storeToken($this->token,$this->credentials['client_id']);
229
-        }else{
229
+        } else{
230 230
             $error = $response->getBody();
231 231
             throw new AuthenticationException("Refresh Response [".$error['error']."] ".$error['error_message']);
232 232
         }
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
             if ($response->getStatus()=='200'){
245 245
                 unset($this->token);
246 246
                 static::removeStoredToken($this->credentials['client_id']);
247
-            }else{
247
+            } else{
248 248
                 $error = $response->getBody();
249 249
                 throw new AuthenticationException("Logout Response [".$error['error']."] ".$error['message']);
250 250
             }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      * @inheritdoc
257 257
      * @param \stdClass $token
258 258
      */
259
-    public static function storeToken($token, $client_id) {
259
+    public static function storeToken($token, $client_id){
260 260
         static::$_STORED_TOKENS[$client_id] = $token;
261 261
         return TRUE;
262 262
     }
@@ -264,14 +264,14 @@  discard block
 block discarded – undo
264 264
     /**
265 265
      * @inheritdoc
266 266
      */
267
-    public static function getStoredToken($client_id) {
267
+    public static function getStoredToken($client_id){
268 268
         return (isset(static::$_STORED_TOKENS[$client_id])?static::$_STORED_TOKENS[$client_id]:NULL);
269 269
     }
270 270
 
271 271
     /**
272 272
      * @inheritdoc
273 273
      */
274
-    public static function removeStoredToken($client_id) {
274
+    public static function removeStoredToken($client_id){
275 275
         unset(static::$_STORED_TOKENS[$client_id]);
276 276
         return TRUE;
277 277
     }
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.