Passed
Push — master ( 54d9ab...d9df60 )
by Mike
02:54
created
src/EntryPoint/Abstracts/AbstractEntryPoint.php 3 patches
Upper-Lower-Casing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * Whether or not Authentication is Required
45 45
      * @var bool
46 46
      */
47
-    protected $_AUTH_REQUIRED = true;
47
+    protected $_AUTH_REQUIRED = TRUE;
48 48
 
49 49
     /**
50 50
      * The URL for the EntryPoint
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         if (strpos($UrlArray[0],"$") !== FALSE){
321 321
             throw new InvalidURLException(get_called_class(),"Configured URL is ".$this->Url);
322 322
         }
323
-        return true;
323
+        return TRUE;
324 324
     }
325 325
 
326 326
     /**
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
         if ($urlVarCount>$optionCount){
336 336
             throw new RequiredOptionsException(get_called_class(),"URL requires $urlVarCount options, only $optionCount provided.");
337 337
         }
338
-        return true;
338
+        return TRUE;
339 339
     }
340 340
 
341 341
     /**
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
         if (!empty($this->_REQUIRED_DATA)){
351 351
             $this->verifyRequiredData();
352 352
         }
353
-        return true;
353
+        return TRUE;
354 354
     }
355 355
 
356 356
     /**
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
         if (gettype($this->Data) !== $this->_DATA_TYPE) {
363 363
             throw new RequiredDataException(get_called_class(),"Valid DataType is {$this->_DATA_TYPE}");
364 364
         }
365
-        return true;
365
+        return TRUE;
366 366
     }
367 367
 
368 368
     /**
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
         if (count($errors)>0){
381 381
             throw new RequiredDataException(get_called_class(),"Missing data for ".implode(",",$errors));
382 382
         }
383
-        return true;
383
+        return TRUE;
384 384
     }
385 385
 
386 386
     /**
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
     protected $accessToken;
117 117
 
118 118
 
119
-    public function __construct($baseUrl,array $options = array()){
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
     }
@@ -218,13 +218,13 @@  discard block
 block discarded – undo
218 218
      * @throws InvalidURLException
219 219
      */
220 220
     public function execute($data = NULL){
221
-        $data =  ($data === NULL?$this->Data:$data);
221
+        $data = ($data===NULL?$this->Data:$data);
222 222
         $this->configureData($data);
223
-        if ($this->verifyOptions() && is_object($this->Request)) {
223
+        if ($this->verifyOptions() && is_object($this->Request)){
224 224
             $this->configureRequest();
225 225
             $this->Request->send();
226 226
         }else{
227
-            throw new InvalidRequestException(get_called_class(),"Request property not configured");
227
+            throw new InvalidRequestException(get_called_class(), "Request property not configured");
228 228
         }
229 229
         return $this;
230 230
     }
@@ -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
     }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      * @var $data
266 266
      */
267 267
     protected function configureData($data){
268
-        if (!empty($this->_REQUIRED_DATA)&&is_array($data)){
268
+        if (!empty($this->_REQUIRED_DATA) && is_array($data)){
269 269
             $data = $this->configureDefaultData($data);
270 270
         }
271 271
         $this->setData($data);
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      * @return array
278 278
      */
279 279
     protected function configureDefaultData(array $data){
280
-        foreach($this->_REQUIRED_DATA as $property => $value){
280
+        foreach ($this->_REQUIRED_DATA as $property => $value){
281 281
             if (!isset($data[$property]) && $value!==NULL){
282 282
                 $data[$property] = $value;
283 283
             }
@@ -292,18 +292,18 @@  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
                     }
304 304
                 }
305 305
             }
306
-            $url = implode($urlParts,"/");
306
+            $url = implode($urlParts, "/");
307 307
         }
308 308
         $url = $this->baseUrl.$url;
309 309
         $this->setUrl($url);
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
      * @throws InvalidURLException
316 316
      */
317 317
     protected function verifyUrl(){
318
-        $UrlArray = explode("?",$this->Url);
319
-        if (strpos($UrlArray[0],"$") !== FALSE){
320
-            throw new InvalidURLException(get_called_class(),"Configured URL is ".$this->Url);
318
+        $UrlArray = explode("?", $this->Url);
319
+        if (strpos($UrlArray[0], "$")!==FALSE){
320
+            throw new InvalidURLException(get_called_class(), "Configured URL is ".$this->Url);
321 321
         }
322 322
         return true;
323 323
     }
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
      * @throws RequiredOptionsException
329 329
      */
330 330
     protected function verifyOptions(){
331
-        $urlVarCount = substr_count($this->_URL,"$");
331
+        $urlVarCount = substr_count($this->_URL, "$");
332 332
         $optionCount = 0;
333 333
         $optionCount += count($this->Options);
334 334
         if ($urlVarCount>$optionCount){
335
-            throw new RequiredOptionsException(get_called_class(),"URL requires $urlVarCount options, only $optionCount provided.");
335
+            throw new RequiredOptionsException(get_called_class(), "URL requires $urlVarCount options, only $optionCount provided.");
336 336
         }
337 337
         return true;
338 338
     }
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
      * @throws RequiredDataException
344 344
      */
345 345
     protected function verifyData(){
346
-        if (isset($this->_DATA_TYPE)||!empty($this->_DATA_TYPE)) {
346
+        if (isset($this->_DATA_TYPE) || !empty($this->_DATA_TYPE)){
347 347
             $this->verifyDataType();
348 348
         }
349 349
         if (!empty($this->_REQUIRED_DATA)){
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
      * @throws RequiredDataException
359 359
      */
360 360
     protected function verifyDataType(){
361
-        if (gettype($this->Data) !== $this->_DATA_TYPE) {
362
-            throw new RequiredDataException(get_called_class(),"Valid DataType is {$this->_DATA_TYPE}");
361
+        if (gettype($this->Data)!==$this->_DATA_TYPE){
362
+            throw new RequiredDataException(get_called_class(), "Valid DataType is {$this->_DATA_TYPE}");
363 363
         }
364 364
         return true;
365 365
     }
@@ -371,13 +371,13 @@  discard block
 block discarded – undo
371 371
      */
372 372
     protected function verifyRequiredData(){
373 373
         $errors = array();
374
-        foreach($this->_REQUIRED_DATA as $property => $defaultValue){
374
+        foreach ($this->_REQUIRED_DATA as $property => $defaultValue){
375 375
             if (!isset($this->Data[$property])){
376 376
                 $errors[] = $property;
377 377
             }
378 378
         }
379 379
         if (count($errors)>0){
380
-            throw new RequiredDataException(get_called_class(),"Missing data for ".implode(",",$errors));
380
+            throw new RequiredDataException(get_called_class(), "Missing data for ".implode(",", $errors));
381 381
         }
382 382
         return true;
383 383
     }
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
      * @return bool
388 388
      */
389 389
     protected function requiresOptions(){
390
-        return strpos($this->_URL,"$") === FALSE?FALSE:TRUE;
390
+        return strpos($this->_URL, "$")===FALSE?FALSE:TRUE;
391 391
     }
392 392
 
393 393
 }
394 394
\ No newline at end of file
Please login to merge, or discard this 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 ($this->verifyOptions() && is_object($this->Request)) {
223
+        if ($this->verifyOptions() && 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
                     }
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
      * @throws RequiredDataException
344 344
      */
345 345
     protected function verifyData(){
346
-        if (isset($this->_DATA_TYPE)||!empty($this->_DATA_TYPE)) {
346
+        if (isset($this->_DATA_TYPE)||!empty($this->_DATA_TYPE)){
347 347
             $this->verifyDataType();
348 348
         }
349 349
         if (!empty($this->_REQUIRED_DATA)){
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
      * @throws RequiredDataException
359 359
      */
360 360
     protected function verifyDataType(){
361
-        if (gettype($this->Data) !== $this->_DATA_TYPE) {
361
+        if (gettype($this->Data) !== $this->_DATA_TYPE){
362 362
             throw new RequiredDataException(get_called_class(),"Valid DataType is {$this->_DATA_TYPE}");
363 363
         }
364 364
         return true;
Please login to merge, or discard this patch.
src/EntryPoint/POST/OAuth2Token.php 1 patch
Upper-Lower-Casing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@
 block discarded – undo
6 6
 
7 7
 class OAuth2Token extends AbstractPostEntryPoint {
8 8
 
9
-    protected $_AUTH_REQUIRED = false;
9
+    protected $_AUTH_REQUIRED = FALSE;
10 10
     protected $_URL = 'oauth2/token';
11 11
     protected $_REQUIRED_DATA = array(
12
-        'username' => null,
13
-        'password' => null,
12
+        'username' => NULL,
13
+        'password' => NULL,
14 14
         'grant_type' => 'password',
15
-        'client_id' => null,
16
-        'client_secret' => null,
17
-        'platform' => null
15
+        'client_id' => NULL,
16
+        'client_secret' => NULL,
17
+        'platform' => NULL
18 18
     );
19 19
     protected $_DATA_TYPE = 'array';
20 20
 
Please login to merge, or discard this patch.
src/Response/JSON.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     /**
18 18
      * @inheritdoc
19 19
      */
20
-    public function getBody($asArray = true){
20
+    public function getBody($asArray = TRUE){
21 21
         return json_decode($this->body, $asArray);
22 22
     }
23 23
 
Please login to merge, or discard this patch.
src/Response/File.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,7 @@
 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
             }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
      */
19 19
     protected $destinationPath;
20 20
 
21
-    public function __construct($curlResponse, $curlRequest, $destination = null){
21
+    public function __construct($curlResponse, $curlRequest, $destination = NULL){
22 22
         parent::__construct($curlResponse, $curlRequest);
23 23
         $this->extractFileName();
24 24
         if (!empty($destination)){
Please login to merge, or discard this patch.
src/EntryPoint/Abstracts/GET/AbstractGetFileEntryPoint.php 1 patch
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@
 block discarded – undo
12 12
      * The directory in which to download the File
13 13
      * @var string
14 14
      */
15
-    protected $downloadDir = null;
15
+    protected $downloadDir = NULL;
16 16
 
17 17
     public function __construct($url, array $options = array()){
18 18
         $this->setRequest(new GETFile());
19 19
         parent::__construct($url, $options);
20 20
     }
21 21
 
22
-    public function execute($data = null){
22
+    public function execute($data = NULL){
23 23
         parent::execute($data);
24 24
         $this->setResponse(new FileResponse($this->Request->getResponse(), $this->Request->getCurlObject(), $this->downloadDir));
25 25
         return $this;
Please login to merge, or discard this patch.
src/EntryPoint/Abstracts/DELETE/AbstractDeleteEntryPoint.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,14 +9,14 @@
 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
-        $this->setResponse(new JSON($this->Request->getResponse(),$this->Request->getCurlObject()));
19
+        $this->setResponse(new JSON($this->Request->getResponse(), $this->Request->getCurlObject()));
20 20
         return $this;
21 21
     }
22 22
 
Please login to merge, or discard this 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/EntryPoint/Abstracts/POST/AbstractPostFileEntryPoint.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
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.