Test Failed
Push — master ( d9b525...db8114 )
by Mike
02:47
created
src/EntryPoint/POST/ModuleRecordFileField.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,19 +32,19 @@
 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
         }
45 45
         if (is_array($data)){
46 46
             foreach ($data as $key => $value){
47
-                if (!array_key_exists($key,$this->_REQUIRED_DATA)){
47
+                if (!array_key_exists($key, $this->_REQUIRED_DATA)){
48 48
                     $data[$key] = $this->setFileFieldValue($value);
49 49
                 }
50 50
             }
Please login to merge, or discard this patch.
src/EntryPoint/POST/Bulk.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,23 +30,23 @@
 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();
49
-                    $requestData['requests'][$counter]['url'] = "v10/" . str_replace($this->baseUrl, "", $EntryPoint->getUrl());
49
+                    $requestData['requests'][$counter]['url'] = "v10/".str_replace($this->baseUrl, "", $EntryPoint->getUrl());
50 50
 
51 51
                     $counter++;
52 52
                 }
Please login to merge, or discard this patch.
src/Client/Abstracts/AbstractClient.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
      */
61 61
     protected $entryPoints = array();
62 62
 
63
-    public function __construct($server = '',array $credentials = array()){
63
+    public function __construct($server = '', array $credentials = array()){
64 64
         $server = (empty($server)?$this->server:$server);
65
-        if (!empty($server)) {
65
+        if (!empty($server)){
66 66
             $this->setServer($server);
67 67
         }
68 68
         $credentials = (empty($credentials)?$this->credentials:$credentials);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      * @inheritdoc
77 77
      * @param string $server
78 78
      */
79
-    public function setServer($server) {
79
+    public function setServer($server){
80 80
         $this->server = $server;
81 81
         $this->apiURL = Helpers::configureAPIURL($this->server);
82 82
         return $this;
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     /**
86 86
      * @inheritdoc
87 87
      */
88
-    public function getAPIUrl() {
88
+    public function getAPIUrl(){
89 89
         return $this->apiURL;
90 90
     }
91 91
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     /**
129 129
      * @inheritdoc
130 130
      */
131
-    public function getServer() {
131
+    public function getServer(){
132 132
         return $this->server;
133 133
     }
134 134
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      * @inheritdoc
137 137
      */
138 138
     public function authenticated(){
139
-        return time() < $this->expiration;
139
+        return time()<$this->expiration;
140 140
     }
141 141
 
142 142
     /**
@@ -158,10 +158,10 @@  discard block
 block discarded – undo
158 158
      */
159 159
     public function registerEntryPoint($funcName, $className){
160 160
         $implements = class_implements($className);
161
-        if (is_array($implements) && in_array('SugarAPI\SDK\EntryPoint\Interfaces\EPInterface',$implements)){
161
+        if (is_array($implements) && in_array('SugarAPI\SDK\EntryPoint\Interfaces\EPInterface', $implements)){
162 162
             $this->entryPoints[$funcName] = $className;
163 163
         }else{
164
-            throw new EntryPointException($className,'Class must extend SugarAPI\SDK\EntryPoint\Interfaces\EPInterface');
164
+            throw new EntryPointException($className, 'Class must extend SugarAPI\SDK\EntryPoint\Interfaces\EPInterface');
165 165
         }
166 166
         return $this;
167 167
     }
@@ -179,13 +179,13 @@  discard block
 block discarded – undo
179 179
             $EntryPoint = new $Class($this->apiURL, $params);
180 180
 
181 181
             if ($EntryPoint->authRequired()){
182
-                if (isset($this->token) && $this->authenticated()) {
182
+                if (isset($this->token) && $this->authenticated()){
183 183
                     $EntryPoint->setAuth($this->getToken()->access_token);
184 184
                 }
185 185
             }
186 186
             return $EntryPoint;
187 187
         }else{
188
-            throw new EntryPointException($name,'Unregistered EntryPoint');
188
+            throw new EntryPointException($name, 'Unregistered EntryPoint');
189 189
         }
190 190
     }
191 191
 
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
      * @inheritdoc
194 194
      * @throws AuthenticationException - When Login request fails
195 195
      */
196
-    public function login() {
196
+    public function login(){
197 197
         $EP = new OAuth2Token($this->apiURL);
198 198
         $response = $EP->execute($this->credentials)->getResponse();
199 199
         if ($response->getStatus()=='200'){
200 200
             $this->setToken($response->getBody(FALSE));
201
-            static::storeToken($this->token,$this->credentials['client_id']);
202
-        } else {
201
+            static::storeToken($this->token, $this->credentials['client_id']);
202
+        }else{
203 203
             $error = $response->getBody();
204 204
             throw new AuthenticationException("Login Response [".$error['error']."] ".$error['error_message']);
205 205
         }
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
         $response = $EP->execute($refreshOptions)->getResponse();
221 221
         if ($response->getStatus()=='200'){
222 222
             $this->setToken($response->getBody(FALSE));
223
-            static::storeToken($this->token,$this->credentials['client_id']);
223
+            static::storeToken($this->token, $this->credentials['client_id']);
224 224
         }else{
225 225
             $error = $response->getBody();
226 226
             throw new AuthenticationException("Refresh Response [".$error['error']."] ".$error['error_message']);
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
      * @inheritdoc
252 252
      * @param \stdClass $token
253 253
      */
254
-    public static function storeToken($token, $client_id) {
254
+    public static function storeToken($token, $client_id){
255 255
         static::$_STORED_TOKENS[$client_id] = $token;
256 256
         return TRUE;
257 257
     }
@@ -259,14 +259,14 @@  discard block
 block discarded – undo
259 259
     /**
260 260
      * @inheritdoc
261 261
      */
262
-    public static function getStoredToken($client_id) {
262
+    public static function getStoredToken($client_id){
263 263
         return (isset(static::$_STORED_TOKENS[$client_id])?static::$_STORED_TOKENS[$client_id]:NULL);
264 264
     }
265 265
 
266 266
     /**
267 267
      * @inheritdoc
268 268
      */
269
-    public static function removeStoredToken($client_id) {
269
+    public static function removeStoredToken($client_id){
270 270
         unset(static::$_STORED_TOKENS[$client_id]);
271 271
         return TRUE;
272 272
     }
Please login to merge, or discard this patch.