@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | use Psr\Log\LoggerInterface; |
21 | 21 | |
22 | -require_once(__DIR__ . '/../OATH/OCRAParser.php'); |
|
22 | +require_once(__DIR__.'/../OATH/OCRAParser.php'); |
|
23 | 23 | |
24 | 24 | abstract class Tiqr_OcraService_Abstract implements Tiqr_OcraService_Interface |
25 | 25 | { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $this->logger = $logger; |
38 | 38 | |
39 | 39 | // Set the OCRA suite |
40 | - $this->_ocraSuite = $config['ocra.suite'] ?? 'OCRA-1:HOTP-SHA1-6:QH10-S'; // Use tiqr server default suite |
|
40 | + $this->_ocraSuite = $config['ocra.suite'] ?? 'OCRA-1:HOTP-SHA1-6:QH10-S'; // Use tiqr server default suite |
|
41 | 41 | $this->_ocraParser = new OATH_OCRAParser($this->_ocraSuite); |
42 | 42 | } |
43 | 43 |
@@ -547,17 +547,17 @@ discard block |
||
547 | 547 | } |
548 | 548 | |
549 | 549 | $metadata = array("service"=> |
550 | - array("displayName" => $this->_name, |
|
551 | - "identifier" => $this->_identifier, |
|
552 | - "logoUrl" => $this->_logoUrl, |
|
553 | - "infoUrl" => $this->_infoUrl, |
|
554 | - "authenticationUrl" => $authenticationUrl, |
|
555 | - "ocraSuite" => $this->_ocraSuite, |
|
556 | - "enrollmentUrl" => $enrollmentUrl |
|
557 | - ), |
|
558 | - "identity"=> |
|
559 | - array("identifier" =>$data["userId"], |
|
560 | - "displayName"=>$data["displayName"])); |
|
550 | + array("displayName" => $this->_name, |
|
551 | + "identifier" => $this->_identifier, |
|
552 | + "logoUrl" => $this->_logoUrl, |
|
553 | + "infoUrl" => $this->_infoUrl, |
|
554 | + "authenticationUrl" => $authenticationUrl, |
|
555 | + "ocraSuite" => $this->_ocraSuite, |
|
556 | + "enrollmentUrl" => $enrollmentUrl |
|
557 | + ), |
|
558 | + "identity"=> |
|
559 | + array("identifier" =>$data["userId"], |
|
560 | + "displayName"=>$data["displayName"])); |
|
561 | 561 | |
562 | 562 | $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT . $enrollmentKey); |
563 | 563 | |
@@ -587,27 +587,27 @@ discard block |
||
587 | 587 | */ |
588 | 588 | public function getEnrollmentSecret(string $enrollmentKey): string |
589 | 589 | { |
590 | - $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey); |
|
591 | - if (!is_array($data)) { |
|
592 | - $this->logger->error('getEnrollmentSecret: enrollment key not found'); |
|
593 | - throw new RuntimeException('enrollment key not found'); |
|
594 | - } |
|
595 | - $userId = $data["userId"] ?? NULL; |
|
596 | - $sessionId = $data["sessionId"] ?? NULL; |
|
597 | - if (!is_string($userId) || !(is_string($sessionId))) { |
|
598 | - throw new RuntimeException('getEnrollmentSecret: invalid enrollment data'); |
|
599 | - } |
|
600 | - $enrollmentData = [ |
|
601 | - "userId" => $userId, |
|
602 | - "sessionId" => $sessionId |
|
603 | - ]; |
|
604 | - $enrollmentSecret = $this->_uniqueSessionKey(); |
|
605 | - $this->_stateStorage->setValue( |
|
606 | - self::PREFIX_ENROLLMENT_SECRET . $enrollmentSecret, |
|
607 | - $enrollmentData, |
|
608 | - self::ENROLLMENT_EXPIRE |
|
609 | - ); |
|
610 | - return $enrollmentSecret; |
|
590 | + $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey); |
|
591 | + if (!is_array($data)) { |
|
592 | + $this->logger->error('getEnrollmentSecret: enrollment key not found'); |
|
593 | + throw new RuntimeException('enrollment key not found'); |
|
594 | + } |
|
595 | + $userId = $data["userId"] ?? NULL; |
|
596 | + $sessionId = $data["sessionId"] ?? NULL; |
|
597 | + if (!is_string($userId) || !(is_string($sessionId))) { |
|
598 | + throw new RuntimeException('getEnrollmentSecret: invalid enrollment data'); |
|
599 | + } |
|
600 | + $enrollmentData = [ |
|
601 | + "userId" => $userId, |
|
602 | + "sessionId" => $sessionId |
|
603 | + ]; |
|
604 | + $enrollmentSecret = $this->_uniqueSessionKey(); |
|
605 | + $this->_stateStorage->setValue( |
|
606 | + self::PREFIX_ENROLLMENT_SECRET . $enrollmentSecret, |
|
607 | + $enrollmentData, |
|
608 | + self::ENROLLMENT_EXPIRE |
|
609 | + ); |
|
610 | + return $enrollmentSecret; |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | // INVALID_USERID: The client authenticated a different user than the server expected. This error is returned when |
118 | 118 | // the application stated an authentication session specifying the userId and later during the authentication |
119 | 119 | // provides a different userId |
120 | - const AUTH_RESULT_INVALID_USERID = 5; |
|
120 | + const AUTH_RESULT_INVALID_USERID = 5; |
|
121 | 121 | |
122 | 122 | /** |
123 | 123 | * The default OCRA Suite (RFC 6287) to use for authentication in Tiqr |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * @param int $version The tiqr protocol version to use (defaults to the latest) |
224 | 224 | * @throws Exception |
225 | 225 | */ |
226 | - public function __construct(LoggerInterface $logger, array $options=array(), int $version = 2) |
|
226 | + public function __construct(LoggerInterface $logger, array $options = array(), int $version = 2) |
|
227 | 227 | { |
228 | 228 | $this->_options = $options; // Used to later get settings for Tiqr_Message_* |
229 | 229 | $this->logger = $logger; |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | |
338 | 338 | $this->logger->info(sprintf('Creating and sending a %s push notification', $notificationType)); |
339 | 339 | $message->setId(time()); |
340 | - $message->setText("Please authenticate for " . $this->_name); |
|
340 | + $message->setText("Please authenticate for ".$this->_name); |
|
341 | 341 | $message->setAddress($notificationAddress); |
342 | 342 | $message->setCustomProperty('challenge', $this->_getChallengeUrl($sessionKey)); |
343 | 343 | $message->send(); |
@@ -383,13 +383,13 @@ discard block |
||
383 | 383 | * @return string The authentication sessionKey |
384 | 384 | * @throws Exception when starting the authentication session failed |
385 | 385 | */ |
386 | - public function startAuthenticationSession(string $userId="", string $sessionId="", string $spIdentifier=""): string |
|
386 | + public function startAuthenticationSession(string $userId = "", string $sessionId = "", string $spIdentifier = ""): string |
|
387 | 387 | { |
388 | - if ($sessionId=="") { |
|
388 | + if ($sessionId == "") { |
|
389 | 389 | $sessionId = session_id(); |
390 | 390 | } |
391 | 391 | |
392 | - if ($spIdentifier=="") { |
|
392 | + if ($spIdentifier == "") { |
|
393 | 393 | $spIdentifier = $this->_identifier; |
394 | 394 | } |
395 | 395 | |
@@ -398,11 +398,11 @@ discard block |
||
398 | 398 | |
399 | 399 | $data = array("sessionId"=>$sessionId, "challenge"=>$challenge, "spIdentifier" => $spIdentifier); |
400 | 400 | |
401 | - if ($userId!="") { |
|
401 | + if ($userId != "") { |
|
402 | 402 | $data["userId"] = $userId; |
403 | 403 | } |
404 | 404 | |
405 | - $this->_stateStorage->setValue(self::PREFIX_CHALLENGE . $sessionKey, $data, self::CHALLENGE_EXPIRE); |
|
405 | + $this->_stateStorage->setValue(self::PREFIX_CHALLENGE.$sessionKey, $data, self::CHALLENGE_EXPIRE); |
|
406 | 406 | |
407 | 407 | return $sessionKey; |
408 | 408 | } |
@@ -422,9 +422,9 @@ discard block |
||
422 | 422 | * @return String The enrollment key |
423 | 423 | * @throws Exception when start the enrollement session failed |
424 | 424 | */ |
425 | - public function startEnrollmentSession(string $userId, string $displayName, string $sessionId=""): string |
|
425 | + public function startEnrollmentSession(string $userId, string $displayName, string $sessionId = ""): string |
|
426 | 426 | { |
427 | - if ($sessionId=="") { |
|
427 | + if ($sessionId == "") { |
|
428 | 428 | $sessionId = session_id(); |
429 | 429 | } |
430 | 430 | $enrollmentKey = $this->_uniqueSessionKey(); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | "displayName" => $displayName, |
434 | 434 | "sessionId" => $sessionId |
435 | 435 | ]; |
436 | - $this->_stateStorage->setValue(self::PREFIX_ENROLLMENT . $enrollmentKey, $data, self::ENROLLMENT_EXPIRE); |
|
436 | + $this->_stateStorage->setValue(self::PREFIX_ENROLLMENT.$enrollmentKey, $data, self::ENROLLMENT_EXPIRE); |
|
437 | 437 | $this->_setEnrollmentStatus($sessionId, self::ENROLLMENT_STATUS_INITIALIZED); |
438 | 438 | |
439 | 439 | return $enrollmentKey; |
@@ -444,9 +444,9 @@ discard block |
||
444 | 444 | * @param string $sessionId The application's session identifier (defaults to php session) |
445 | 445 | * @throws Exception when resetting the session failed |
446 | 446 | */ |
447 | - public function resetEnrollmentSession(string $sessionId=""): void |
|
447 | + public function resetEnrollmentSession(string $sessionId = ""): void |
|
448 | 448 | { |
449 | - if ($sessionId=="") { |
|
449 | + if ($sessionId == "") { |
|
450 | 450 | $sessionId = session_id(); |
451 | 451 | } |
452 | 452 | |
@@ -481,9 +481,9 @@ discard block |
||
481 | 481 | * |
482 | 482 | * @throws Exception when an error communicating with the state storage backend was detected |
483 | 483 | */ |
484 | - public function getEnrollmentStatus(string $sessionId=""): int |
|
484 | + public function getEnrollmentStatus(string $sessionId = ""): int |
|
485 | 485 | { |
486 | - if ($sessionId=="") { |
|
486 | + if ($sessionId == "") { |
|
487 | 487 | $sessionId = session_id(); |
488 | 488 | } |
489 | 489 | $status = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT_STATUS.$sessionId); |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | */ |
541 | 541 | public function getEnrollmentMetadata(string $enrollmentKey, string $authenticationUrl, string $enrollmentUrl): array |
542 | 542 | { |
543 | - $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey); |
|
543 | + $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT.$enrollmentKey); |
|
544 | 544 | if (!is_array($data)) { |
545 | 545 | $this->logger->error('Unable to find enrollment metadata in state storage'); |
546 | 546 | throw new Exception('Unable to find enrollment metadata in state storage'); |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | array("identifier" =>$data["userId"], |
560 | 560 | "displayName"=>$data["displayName"])); |
561 | 561 | |
562 | - $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT . $enrollmentKey); |
|
562 | + $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT.$enrollmentKey); |
|
563 | 563 | |
564 | 564 | $this->_setEnrollmentStatus($data["sessionId"], self::ENROLLMENT_STATUS_RETRIEVED); |
565 | 565 | return $metadata; |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | */ |
588 | 588 | public function getEnrollmentSecret(string $enrollmentKey): string |
589 | 589 | { |
590 | - $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey); |
|
590 | + $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT.$enrollmentKey); |
|
591 | 591 | if (!is_array($data)) { |
592 | 592 | $this->logger->error('getEnrollmentSecret: enrollment key not found'); |
593 | 593 | throw new RuntimeException('enrollment key not found'); |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | ]; |
604 | 604 | $enrollmentSecret = $this->_uniqueSessionKey(); |
605 | 605 | $this->_stateStorage->setValue( |
606 | - self::PREFIX_ENROLLMENT_SECRET . $enrollmentSecret, |
|
606 | + self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret, |
|
607 | 607 | $enrollmentData, |
608 | 608 | self::ENROLLMENT_EXPIRE |
609 | 609 | ); |
@@ -631,11 +631,11 @@ discard block |
||
631 | 631 | public function validateEnrollmentSecret(string $enrollmentSecret): string |
632 | 632 | { |
633 | 633 | try { |
634 | - $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT_SECRET . $enrollmentSecret); |
|
634 | + $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret); |
|
635 | 635 | if (NULL === $data) { |
636 | 636 | throw new RuntimeException('Enrollment secret not found'); |
637 | 637 | } |
638 | - if ( !is_array($data) || !is_string($data["userId"] ?? NULL)) { |
|
638 | + if (!is_array($data) || !is_string($data["userId"] ?? NULL)) { |
|
639 | 639 | throw new RuntimeException('Invalid enrollment data'); |
640 | 640 | } |
641 | 641 | |
@@ -665,17 +665,17 @@ discard block |
||
665 | 665 | public function finalizeEnrollment(string $enrollmentSecret): bool |
666 | 666 | { |
667 | 667 | try { |
668 | - $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT_SECRET . $enrollmentSecret); |
|
668 | + $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret); |
|
669 | 669 | if (NULL === $data) { |
670 | 670 | throw new RuntimeException('Enrollment secret not found'); |
671 | 671 | } |
672 | 672 | if (is_array($data)) { |
673 | 673 | // Enrollment is finalized, destroy our session data. |
674 | - $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT_SECRET . $enrollmentSecret); |
|
674 | + $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret); |
|
675 | 675 | $this->_setEnrollmentStatus($data["sessionId"], self::ENROLLMENT_STATUS_FINALIZED); |
676 | 676 | } else { |
677 | 677 | $this->logger->error( |
678 | - 'Enrollment status is not finalized, enrollmentsecret was not found in state storage. ' . |
|
678 | + 'Enrollment status is not finalized, enrollmentsecret was not found in state storage. '. |
|
679 | 679 | 'Warning! the method will still return "true" as a result.' |
680 | 680 | ); |
681 | 681 | } |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | public function authenticate(string $userId, string $userSecret, string $sessionKey, string $response): int |
724 | 724 | { |
725 | 725 | try { |
726 | - $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE . $sessionKey); |
|
726 | + $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE.$sessionKey); |
|
727 | 727 | if (is_null($state)) { |
728 | 728 | $this->logger->notice('The auth challenge could not be found in the state storage'); |
729 | 729 | return self::AUTH_RESULT_INVALID_CHALLENGE; |
@@ -733,9 +733,9 @@ discard block |
||
733 | 733 | throw $e; |
734 | 734 | } |
735 | 735 | |
736 | - $sessionId = $state["sessionId"] ?? NULL; // Application's sessionId |
|
737 | - $challenge = $state["challenge"] ?? NULL; // The challenge we sent to the Tiqr client |
|
738 | - if (!is_string($sessionId) || (!is_string($challenge)) ) { |
|
736 | + $sessionId = $state["sessionId"] ?? NULL; // Application's sessionId |
|
737 | + $challenge = $state["challenge"] ?? NULL; // The challenge we sent to the Tiqr client |
|
738 | + if (!is_string($sessionId) || (!is_string($challenge))) { |
|
739 | 739 | throw new RuntimeException('Invalid state for state storage'); |
740 | 740 | } |
741 | 741 | |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | $challengeUserId = $state["userId"] ?? NULL; |
745 | 745 | |
746 | 746 | // If the application requested a specific userId, verify that that is that userId that we're now authenticating |
747 | - if ($challengeUserId!==NULL && ($userId !== $challengeUserId)) { |
|
747 | + if ($challengeUserId !== NULL && ($userId !== $challengeUserId)) { |
|
748 | 748 | $this->logger->error( |
749 | 749 | sprintf('Authentication failed: the requested userId "%s" does not match userId "%s" that is being authenticated', |
750 | 750 | $challengeUserId, $userId) |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | |
762 | 762 | if ($equal) { |
763 | 763 | // Set application session as authenticated |
764 | - $this->_stateStorage->setValue(self::PREFIX_AUTHENTICATED . $sessionId, $userId, self::LOGIN_EXPIRE); |
|
764 | + $this->_stateStorage->setValue(self::PREFIX_AUTHENTICATED.$sessionId, $userId, self::LOGIN_EXPIRE); |
|
765 | 765 | $this->logger->notice(sprintf('Authenticated user "%s" in session "%s"', $userId, $sessionId)); |
766 | 766 | |
767 | 767 | // Cleanup challenge |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | // Cleaning up only after successful authentication enables the user to retry authentication after e.g. an |
771 | 771 | // invalid response |
772 | 772 | try { |
773 | - $this->_stateStorage->unsetValue(self::PREFIX_CHALLENGE . $sessionKey); // May throw |
|
773 | + $this->_stateStorage->unsetValue(self::PREFIX_CHALLENGE.$sessionKey); // May throw |
|
774 | 774 | } catch (Exception $e) { |
775 | 775 | // Only log error |
776 | 776 | $this->logger->warning('Could not delete authentication session key', array('error' => $e)); |
@@ -792,9 +792,9 @@ discard block |
||
792 | 792 | * |
793 | 793 | * @throws Exception when there was an error communicating with the storage backed |
794 | 794 | */ |
795 | - public function logout(string $sessionId=""): void |
|
795 | + public function logout(string $sessionId = ""): void |
|
796 | 796 | { |
797 | - if ($sessionId=="") { |
|
797 | + if ($sessionId == "") { |
|
798 | 798 | $sessionId = session_id(); |
799 | 799 | } |
800 | 800 | |
@@ -834,9 +834,9 @@ discard block |
||
834 | 834 | * |
835 | 835 | * Does not throw |
836 | 836 | */ |
837 | - public function getAuthenticatedUser(string $sessionId=""): ?string |
|
837 | + public function getAuthenticatedUser(string $sessionId = ""): ?string |
|
838 | 838 | { |
839 | - if ($sessionId=="") { |
|
839 | + if ($sessionId == "") { |
|
840 | 840 | $this->logger->debug('Using the PHP session id, as no session id was provided'); |
841 | 841 | $sessionId = session_id(); |
842 | 842 | } |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | // We probably just generated the challenge and stored it in the StateStorage |
865 | 865 | // We can save a roundtrip to the storage backend here by reusing this information |
866 | 866 | |
867 | - $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE . $sessionKey); |
|
867 | + $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE.$sessionKey); |
|
868 | 868 | if (is_null($state)) { |
869 | 869 | $this->logger->error( |
870 | 870 | sprintf( |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | $spIdentifier = $state["spIdentifier"] ?? ''; |
881 | 881 | |
882 | 882 | // Last bit is the spIdentifier |
883 | - return $this->_protocolAuth."://".(!is_null($userId)?urlencode($userId).'@':'').$this->getIdentifier()."/".$sessionKey."/".$challenge."/".urlencode($spIdentifier)."/".$this->_protocolVersion; |
|
883 | + return $this->_protocolAuth."://".(!is_null($userId) ?urlencode($userId).'@' : '').$this->getIdentifier()."/".$sessionKey."/".$challenge."/".urlencode($spIdentifier)."/".$this->_protocolVersion; |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | /** |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | protected function _uniqueSessionKey(): string |
903 | 903 | { |
904 | 904 | |
905 | - return bin2hex( Tiqr_Random::randomBytes(self::SESSION_KEY_LENGTH_BYTES) ); |
|
905 | + return bin2hex(Tiqr_Random::randomBytes(self::SESSION_KEY_LENGTH_BYTES)); |
|
906 | 906 | } |
907 | 907 | |
908 | 908 | /** |
@@ -263,8 +263,7 @@ discard block |
||
263 | 263 | if (isset($options['ocraservice']) && $options['ocraservice']['type'] != 'tiqr') { |
264 | 264 | $options['ocraservice']['ocra.suite'] = $this->_ocraSuite; |
265 | 265 | $this->_ocraService = Tiqr_OcraService::getOcraService($options['ocraservice']['type'], $options['ocraservice'], $logger); |
266 | - } |
|
267 | - else { // Create default ocraservice |
|
266 | + } else { // Create default ocraservice |
|
268 | 267 | $this->_ocraService = Tiqr_OcraService::getOcraService('tiqr', array('ocra.suite' => $this->_ocraSuite), $logger); |
269 | 268 | } |
270 | 269 | } |
@@ -487,7 +486,9 @@ discard block |
||
487 | 486 | $sessionId = session_id(); |
488 | 487 | } |
489 | 488 | $status = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT_STATUS.$sessionId); |
490 | - if (is_null($status)) return self::ENROLLMENT_STATUS_IDLE; |
|
489 | + if (is_null($status)) { |
|
490 | + return self::ENROLLMENT_STATUS_IDLE; |
|
491 | + } |
|
491 | 492 | return $status; |
492 | 493 | } |
493 | 494 | |
@@ -843,8 +844,7 @@ discard block |
||
843 | 844 | |
844 | 845 | try { |
845 | 846 | return $this->_stateStorage->getValue("authenticated_".$sessionId); |
846 | - } |
|
847 | - catch (Exception $e) { |
|
847 | + } catch (Exception $e) { |
|
848 | 848 | $this->logger->error('getAuthenticatedUser failed', array('exception'=>$e)); |
849 | 849 | return NULL; |
850 | 850 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | public static function randomBytes(int $length): string |
43 | 43 | { |
44 | 44 | // Get $length cryptographically secure pseudo-random bytes |
45 | - $rnd=\random_bytes($length); |
|
45 | + $rnd = \random_bytes($length); |
|
46 | 46 | |
47 | 47 | if (strlen($rnd) !== $length) { |
48 | 48 | throw new Exception("random_bytes did not return the requested number of bytes"); |
@@ -47,7 +47,7 @@ |
||
47 | 47 | * @throws RuntimeException When the options configuration array misses a required parameter |
48 | 48 | * |
49 | 49 | */ |
50 | - public static function getStorage(string $type="file", array $options=array(), LoggerInterface $logger) |
|
50 | + public static function getStorage(string $type = "file", array $options = array(), LoggerInterface $logger) |
|
51 | 51 | { |
52 | 52 | switch ($type) { |
53 | 53 | case "file": |
@@ -22,6 +22,6 @@ |
||
22 | 22 | { |
23 | 23 | // $code must be int, otherwise this throws with Error("Wrong parameters for ReadWriteException") |
24 | 24 | // PDOException::getCode() can return a sting |
25 | - return new self($e->getMessage(), (int)$e->getCode(), $e ); |
|
25 | + return new self($e->getMessage(), (int) $e->getCode(), $e); |
|
26 | 26 | } |
27 | 27 | } |