Test Failed
Push — develop ( c83d6c...a27d56 )
by Michiel
03:12
created
library/tiqr/Tiqr/DeviceStorage/TokenExchange.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,15 +41,15 @@
 block discarded – undo
41 41
     {
42 42
         $url = $this->_options["url"]."?appId=".$this->_options["appid"];
43 43
         
44
-        $url.= "&notificationToken=".$notificationToken;
44
+        $url .= "&notificationToken=".$notificationToken;
45 45
         
46 46
         $output = file_get_contents($url);
47
-        if (stripos($output, "not found")!==false) {
47
+        if (stripos($output, "not found") !== false) {
48 48
             $this->logger->error('Token Exchange failed and responded with: not found', ['full output' => $output]);
49 49
             return false;
50 50
         }
51 51
 
52
-        if (stripos($output, "error")!==false) {
52
+        if (stripos($output, "error") !== false) {
53 53
             $this->logger->error('Token Exchange failed and responded with: error', ['full output' => $output]);
54 54
             return false;
55 55
         }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/DeviceStorage/Abstract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
      * the Tiqr_DeviceStorage factory will call this for you.
59 59
      * @param array $options The options for the s
60 60
      */
61
-    public function __construct($options=array(), LoggerInterface $logger)
61
+    public function __construct($options = array(), LoggerInterface $logger)
62 62
     {
63 63
         $this->_options = $options;
64 64
         $this->logger = $logger;
Please login to merge, or discard this patch.
library/tiqr/Tiqr/StateStorage/Memcache.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      * The default configuration
52 52
      */
53 53
     const DEFAULT_HOST = '127.0.0.1';
54
-    const DEFAULT_PORT =  11211;
54
+    const DEFAULT_PORT = 11211;
55 55
     
56 56
     /**
57 57
      * Get the prefix to use for all keys in memcache.
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      * (non-PHPdoc)
103 103
      * @see library/tiqr/Tiqr/StateStorage/Tiqr_StateStorage_Abstract::setValue()
104 104
      */
105
-    public function setValue($key, $value, $expire=0)
105
+    public function setValue($key, $value, $expire = 0)
106 106
     {  
107 107
         $key = $this->_getKeyPrefix().$key;
108 108
 
Please login to merge, or discard this patch.
library/tiqr/Tiqr/UserStorage/Encryption.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
      *
41 41
      * @return Tiqr_UserStorage_Encryption_Interface
42 42
      */
43
-    public static function getEncryption(LoggerInterface $logger, $type="dummy", $options=array())
43
+    public static function getEncryption(LoggerInterface $logger, $type = "dummy", $options = array())
44 44
     {
45 45
         $logger->info(sprintf('Using %s as UserStorage encryption type', $type));
46 46
         switch ($type) {
Please login to merge, or discard this patch.
library/tiqr/Tiqr/Service.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
     /**
75 75
      * Enrollment status codes
76 76
      */
77
-    const ENROLLMENT_STATUS_IDLE = 1;        // Nothing happens
77
+    const ENROLLMENT_STATUS_IDLE = 1; // Nothing happens
78 78
     const ENROLLMENT_STATUS_INITIALIZED = 2; // An enrollment session has begun
79
-    const ENROLLMENT_STATUS_RETRIEVED = 3;   // The device has retrieved the metadata
80
-    const ENROLLMENT_STATUS_PROCESSED = 4;   // The device has snet back a secret
81
-    const ENROLLMENT_STATUS_FINALIZED = 5;   // The application has stored the secret
82
-    const ENROLLMENT_STATUS_VALIDATED = 6;   // A first succesful authentication was performed
79
+    const ENROLLMENT_STATUS_RETRIEVED = 3; // The device has retrieved the metadata
80
+    const ENROLLMENT_STATUS_PROCESSED = 4; // The device has snet back a secret
81
+    const ENROLLMENT_STATUS_FINALIZED = 5; // The application has stored the secret
82
+    const ENROLLMENT_STATUS_VALIDATED = 6; // A first succesful authentication was performed
83 83
 
84 84
     const PREFIX_ENROLLMENT_SECRET = 'enrollsecret';
85 85
     const PREFIX_ENROLLMENT = 'enroll';
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      * @param array $options
163 163
      * @param int $version The protocol version to use (defaults to the latest)
164 164
      */
165
-    public function __construct(LoggerInterface $logger, $options=array(), $version = 2)
165
+    public function __construct(LoggerInterface $logger, $options = array(), $version = 2)
166 166
     {
167 167
         $this->_options = $options;
168 168
         $this->logger = $logger;
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
             $this->logger->info(sprintf('Creating and sending a %s push notification', $notificationType));
307 307
             $message = new $class($this->_options);
308 308
             $message->setId(time());
309
-            $message->setText("Please authenticate for " . $this->_name);
309
+            $message->setText("Please authenticate for ".$this->_name);
310 310
             $message->setAddress($notificationAddress);
311 311
             $message->setCustomProperty('challenge', $this->_getChallengeUrl($sessionKey));
312 312
             $message->send();
@@ -375,13 +375,13 @@  discard block
 block discarded – undo
375 375
      * @param String $spIdentifier If SP and IDP are 2 different things, pass the url/identifier of the SP the user is logging into.
376 376
      *                             For setups where IDP==SP, just leave this blank.
377 377
      */
378
-    public function startAuthenticationSession($userId="", $sessionId="", $spIdentifier="")
378
+    public function startAuthenticationSession($userId = "", $sessionId = "", $spIdentifier = "")
379 379
     {
380
-        if ($sessionId=="") {
380
+        if ($sessionId == "") {
381 381
             $sessionId = session_id();
382 382
         }
383 383
 
384
-        if ($spIdentifier=="") {
384
+        if ($spIdentifier == "") {
385 385
             $spIdentifier = $this->_identifier;
386 386
         }
387 387
 
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
         
392 392
         $data = array("sessionId"=>$sessionId, "challenge"=>$challenge, "spIdentifier" => $spIdentifier);
393 393
         
394
-        if ($userId!="") {
394
+        if ($userId != "") {
395 395
             $data["userId"] = $userId;
396 396
         }
397 397
         
398
-        $this->_stateStorage->setValue(self::PREFIX_CHALLENGE . $sessionKey, $data, self::CHALLENGE_EXPIRE);
398
+        $this->_stateStorage->setValue(self::PREFIX_CHALLENGE.$sessionKey, $data, self::CHALLENGE_EXPIRE);
399 399
        
400 400
         return $sessionKey;
401 401
     }
@@ -415,9 +415,9 @@  discard block
 block discarded – undo
415 415
      *                           to php session)
416 416
      * @return String The enrollment key
417 417
      */
418
-    public function startEnrollmentSession($userId, $displayName, $sessionId="")
418
+    public function startEnrollmentSession($userId, $displayName, $sessionId = "")
419 419
     {
420
-        if ($sessionId=="") {
420
+        if ($sessionId == "") {
421 421
             $sessionId = session_id();
422 422
         }
423 423
         $enrollmentKey = $this->_uniqueSessionKey(self::PREFIX_ENROLLMENT);
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
             "displayName" => $displayName,
427 427
             "sessionId" => $sessionId
428 428
         ];
429
-        $this->_stateStorage->setValue(self::PREFIX_ENROLLMENT . $enrollmentKey, $data, self::ENROLLMENT_EXPIRE);
429
+        $this->_stateStorage->setValue(self::PREFIX_ENROLLMENT.$enrollmentKey, $data, self::ENROLLMENT_EXPIRE);
430 430
         $this->_setEnrollmentStatus($sessionId, self::ENROLLMENT_STATUS_INITIALIZED);
431 431
 
432 432
         return $enrollmentKey;
@@ -437,9 +437,9 @@  discard block
 block discarded – undo
437 437
      * @param $sessionId The application's session identifier (defaults
438 438
      *                   to php session)
439 439
      */
440
-    public function resetEnrollmentSession($sessionId="")
440
+    public function resetEnrollmentSession($sessionId = "")
441 441
     {
442
-        if ($sessionId=="") {
442
+        if ($sessionId == "") {
443 443
             $sessionId = session_id();
444 444
         }
445 445
 
@@ -484,9 +484,9 @@  discard block
 block discarded – undo
484 484
      *               A first successful authentication was performed 
485 485
      *               (todo: currently not used)
486 486
      */
487
-    public function getEnrollmentStatus($sessionId="")
487
+    public function getEnrollmentStatus($sessionId = "")
488 488
     { 
489
-        if ($sessionId=="") {
489
+        if ($sessionId == "") {
490 490
             $sessionId = session_id(); 
491 491
         }
492 492
         $status = $this->_stateStorage->getValue("enrollstatus".$sessionId);
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
      */
546 546
     public function getEnrollmentMetadata($enrollmentKey, $authenticationUrl, $enrollmentUrl)
547 547
     {
548
-        $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey);
548
+        $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT.$enrollmentKey);
549 549
         if (!is_array($data)) {
550 550
             $this->logger->error('Unable to find enrollment metadata in state storage');
551 551
             return false;
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
                                array("identifier" =>$data["userId"],
565 565
                                      "displayName"=>$data["displayName"]));
566 566
 
567
-        $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT . $enrollmentKey);
567
+        $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT.$enrollmentKey);
568 568
 
569 569
         $this->_setEnrollmentStatus($data["sessionId"], self::ENROLLMENT_STATUS_RETRIEVED);
570 570
         return $metadata;
@@ -585,14 +585,14 @@  discard block
 block discarded – undo
585 585
      */
586 586
     public function getEnrollmentSecret($enrollmentKey)
587 587
     {
588
-         $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey);
588
+         $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT.$enrollmentKey);
589 589
          $secret = $this->_uniqueSessionKey(self::PREFIX_ENROLLMENT_SECRET);
590 590
          $enrollmentData = [
591 591
              "userId" => $data["userId"],
592 592
              "sessionId" => $data["sessionId"]
593 593
          ];
594 594
          $this->_stateStorage->setValue(
595
-             self::PREFIX_ENROLLMENT_SECRET . $secret,
595
+             self::PREFIX_ENROLLMENT_SECRET.$secret,
596 596
              $enrollmentData,
597 597
              self::ENROLLMENT_EXPIRE
598 598
          );
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
              $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret);
643 643
          } else {
644 644
              $this->logger->error(
645
-                 'Enrollment status is not finalized, enrollmentsecret was not found in state storage. ' .
645
+                 'Enrollment status is not finalized, enrollmentsecret was not found in state storage. '.
646 646
                  'Warning! the method will still return "true" as a result.'
647 647
              );
648 648
          }
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
      */
673 673
     public function authenticate($userId, $userSecret, $sessionKey, $response)
674 674
     {
675
-        $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE . $sessionKey);
675
+        $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE.$sessionKey);
676 676
         if (is_null($state)) {
677 677
             $this->logger->info('The auth challenge could not be found in the state storage');
678 678
             return self::AUTH_RESULT_INVALID_CHALLENGE;
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
           $challengeUserId = $state["userId"];
687 687
         }
688 688
         // Check if we're dealing with a second factor
689
-        if ($challengeUserId!=NULL && ($userId != $challengeUserId)) {
689
+        if ($challengeUserId != NULL && ($userId != $challengeUserId)) {
690 690
             $this->logger->error(
691 691
                 'Authentication failed: the first factor user id does not match with that of the second factor'
692 692
             );
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
             $this->_stateStorage->setValue("authenticated_".$sessionId, $userId, self::LOGIN_EXPIRE);
705 705
             
706 706
             // Clean up the challenge.
707
-            $this->_stateStorage->unsetValue(self::PREFIX_CHALLENGE . $sessionKey);
707
+            $this->_stateStorage->unsetValue(self::PREFIX_CHALLENGE.$sessionKey);
708 708
             $this->logger->info('Authentication succeeded');
709 709
             return self::AUTH_RESULT_AUTHENTICATED;
710 710
         }
@@ -717,9 +717,9 @@  discard block
 block discarded – undo
717 717
      * @param String $sessionId The application's session identifier (defaults
718 718
      *                          to the php session).
719 719
      */
720
-    public function logout($sessionId="")
720
+    public function logout($sessionId = "")
721 721
     {
722
-        if ($sessionId=="") {
722
+        if ($sessionId == "") {
723 723
             $sessionId = session_id(); 
724 724
         }
725 725
         
@@ -754,9 +754,9 @@  discard block
 block discarded – undo
754 754
      * @return mixed An array with user data if a user was logged in or NULL if
755 755
      *               no user is logged in.
756 756
      */
757
-    public function getAuthenticatedUser($sessionId="")
757
+    public function getAuthenticatedUser($sessionId = "")
758 758
     {
759
-        if ($sessionId=="") {
759
+        if ($sessionId == "") {
760 760
             $this->logger->debug('Using the PHP session id, as no session id was provided');
761 761
             $sessionId = session_id(); 
762 762
         }
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
      */
776 776
     protected function _getChallengeUrl($sessionKey)
777 777
     {                
778
-        $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE . $sessionKey);
778
+        $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE.$sessionKey);
779 779
         if (is_null($state)) {
780 780
             $this->logger->error(
781 781
                 'Unable find an existing challenge url in the state storage based on the existing session key'
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
             return false;
784 784
         }
785 785
         
786
-        $userId   = NULL;
786
+        $userId = NULL;
787 787
         $challenge = $state["challenge"];
788 788
         if (isset($state["userId"])) {
789 789
             $userId = $state["userId"];
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
         $spIdentifier = $state["spIdentifier"];
792 792
         
793 793
         // Last bit is the spIdentifier
794
-        return $this->_protocolAuth."://".(!is_null($userId)?urlencode($userId).'@':'').$this->getIdentifier()."/".$sessionKey."/".$challenge."/".urlencode($spIdentifier)."/".$this->_protocolVersion;
794
+        return $this->_protocolAuth."://".(!is_null($userId) ?urlencode($userId).'@' : '').$this->getIdentifier()."/".$sessionKey."/".$challenge."/".urlencode($spIdentifier)."/".$this->_protocolVersion;
795 795
     }
796 796
 
797 797
     /**
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
     protected function _uniqueSessionKey($prefix)
816 816
     {      
817 817
         $value = 1;
818
-        while ($value!=NULL) {
818
+        while ($value != NULL) {
819 819
             $sessionKey = $this->_ocraWrapper->generateSessionKey();
820 820
             $value = $this->_stateStorage->getValue($prefix.$sessionKey);
821 821
         }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/UserStorage/FileTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
         if ($data === NULL) {
33 33
             if ($failIfNotFound) {
34
-                throw new Exception('Error loading data for user: ' . var_export($userId, TRUE));
34
+                throw new Exception('Error loading data for user: '.var_export($userId, TRUE));
35 35
             } else {
36 36
                 $this->logger->error('Error loading data for user from user storage (file storage)');
37 37
                 return false;
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function getPath()
49 49
     {
50
-        if (substr($this->path, -1)!="/") return $this->path."/";
50
+        if (substr($this->path, -1) != "/") return $this->path."/";
51 51
         return $this->path;
52 52
     }
53 53
 }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/DeviceStorage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
      * @param LoggerInterface $logger
46 46
      * @throws Exception An exception if an unknown storage is requested.
47 47
      */
48
-    public static function getStorage($type="dummy", $options=array(), LoggerInterface $logger)
48
+    public static function getStorage($type = "dummy", $options = array(), LoggerInterface $logger)
49 49
     {
50 50
         switch ($type) {
51 51
             case "dummy":
Please login to merge, or discard this patch.
library/tiqr/Tiqr/UserStorage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
      *
42 42
      * @throws Exception An exception if an unknown user storage is requested.
43 43
      */
44
-    public static function getStorage($type="file", $options=array(), LoggerInterface $logger)
44
+    public static function getStorage($type = "file", $options = array(), LoggerInterface $logger)
45 45
     {
46 46
         switch ($type) {
47 47
             case "file":
Please login to merge, or discard this patch.
library/tiqr/Tiqr/OcraService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
      * @return Tiqr_OcraService_Interface
40 40
      * @throws Exception An exception if an unknown orca service type is requested.
41 41
      */
42
-    public static function getOcraService($type="tiqr", $options=array(), LoggerInterface $logger)
42
+    public static function getOcraService($type = "tiqr", $options = array(), LoggerInterface $logger)
43 43
     {
44 44
         switch ($type) {
45 45
             case "tiqr":
Please login to merge, or discard this patch.