| @@ -51,7 +51,7 @@ discard block | ||
| 51 | 51 | /** | 
| 52 | 52 | * @throws Tiqr_Message_Exception_SendFailure | 
| 53 | 53 | */ | 
| 54 | - private function getGoogleAccessToken($credentialsFile, $cacheTokens, $tokenCacheDir ) | |
| 54 | + private function getGoogleAccessToken($credentialsFile, $cacheTokens, $tokenCacheDir) | |
| 55 | 55 |      { | 
| 56 | 56 | $client = new Google_Client(); | 
| 57 | 57 | $client->setLogger($this->logger); | 
| @@ -63,8 +63,8 @@ discard block | ||
| 63 | 63 | $pool = new FilesystemCachePool($filesystem); | 
| 64 | 64 | |
| 65 | 65 | //set up a callback to log token refresh | 
| 66 | - $logger=$this->logger; | |
| 67 | -            $tokenCallback = function ($cacheKey, $accessToken) use ($logger) { | |
| 66 | + $logger = $this->logger; | |
| 67 | +            $tokenCallback = function($cacheKey, $accessToken) use ($logger) { | |
| 68 | 68 |                  $logger->notice(sprintf('New access token received at cache key %s', $cacheKey)); | 
| 69 | 69 | }; | 
| 70 | 70 | $client->setTokenCallback($tokenCallback); | 
| @@ -97,9 +97,9 @@ discard block | ||
| 97 | 97 | * @param $retry boolean is this a 2nd attempt | 
| 98 | 98 | * @throws Tiqr_Message_Exception_SendFailure | 
| 99 | 99 | */ | 
| 100 | - private function _sendFirebase(string $deviceToken, string $alert, array $properties, string $projectId, string $credentialsFile, bool $cacheTokens, string $tokenCacheDir, bool $retry=false) | |
| 100 | + private function _sendFirebase(string $deviceToken, string $alert, array $properties, string $projectId, string $credentialsFile, bool $cacheTokens, string $tokenCacheDir, bool $retry = false) | |
| 101 | 101 |      { | 
| 102 | -        $apiurl = sprintf('https://fcm.googleapis.com/v1/projects/%s/messages:send',$projectId); | |
| 102 | +        $apiurl = sprintf('https://fcm.googleapis.com/v1/projects/%s/messages:send', $projectId); | |
| 103 | 103 | |
| 104 | 104 | $fields = [ | 
| 105 | 105 | 'message' => [ | 
| @@ -113,14 +113,14 @@ discard block | ||
| 113 | 113 | |
| 114 | 114 | // Add custom properties | 
| 115 | 115 |          foreach ($properties as $k => $v) { | 
| 116 | - $fields['message']['data'][(string)$k] = (string)$v; | |
| 116 | + $fields['message']['data'][(string) $k] = (string) $v; | |
| 117 | 117 | } | 
| 118 | 118 | // Add message | 
| 119 | 119 | $fields['message']['data']['text'] = $alert; | 
| 120 | 120 | |
| 121 | 121 |          try { | 
| 122 | 122 | $headers = array( | 
| 123 | - 'Authorization: Bearer ' . $this->getGoogleAccessToken($credentialsFile, $cacheTokens, $tokenCacheDir), | |
| 123 | + 'Authorization: Bearer '.$this->getGoogleAccessToken($credentialsFile, $cacheTokens, $tokenCacheDir), | |
| 124 | 124 | 'Content-Type: application/json', | 
| 125 | 125 | ); | 
| 126 | 126 |          } catch (\Google\Exception $e) { | 
| @@ -147,14 +147,14 @@ discard block | ||
| 147 | 147 | } | 
| 148 | 148 | |
| 149 | 149 |          if (!empty($errors)) { | 
| 150 | -            throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ". $errors, true); | |
| 150 | +            throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ".$errors, true); | |
| 151 | 151 | } | 
| 152 | 152 | |
| 153 | 153 | // Wait and retry once in case of a 502 Bad Gateway error | 
| 154 | 154 |          if ($statusCode === 502 && !($retry)) { | 
| 155 | 155 |              $this->logger->warning("Received HTTP 502 Bad Gateway error, retrying once"); | 
| 156 | 156 | sleep(2); | 
| 157 | - $this->_sendFirebase($deviceToken, $alert, $properties, $projectId, $credentialsFile, $cacheTokens, $tokenCacheDir, true); | |
| 157 | + $this->_sendFirebase($deviceToken, $alert, $properties, $projectId, $credentialsFile, $cacheTokens, $tokenCacheDir, true); | |
| 158 | 158 | return; | 
| 159 | 159 | } | 
| 160 | 160 | |
| @@ -165,7 +165,7 @@ discard block | ||
| 165 | 165 | // handle errors, ignoring registration_id's | 
| 166 | 166 | $response = json_decode($result, true); | 
| 167 | 167 |          foreach ($response as $k => $v) { | 
| 168 | -            if ($k=="error") { | |
| 168 | +            if ($k == "error") { | |
| 169 | 169 |                  throw new Tiqr_Message_Exception_SendFailure(sprintf("Error in FCM response: %s", $result), true); | 
| 170 | 170 | } | 
| 171 | 171 | } | 
| @@ -20,11 +20,11 @@ discard block | ||
| 20 | 20 | $options = $this->getOptions(); | 
| 21 | 21 |          if (isset($options['apns.proxy_host_url'])) { | 
| 22 | 22 | // Override CURL options to connect to a HTTP/1.1 to HTTP/2 proxy | 
| 23 | - $curl_options[CURLOPT_URL] = $options['apns.proxy_host_url'] . '/3/device/' . $this->getAddress(); | |
| 23 | + $curl_options[CURLOPT_URL] = $options['apns.proxy_host_url'].'/3/device/'.$this->getAddress(); | |
| 24 | 24 | $curl_options[CURLOPT_PORT] = $options['apns.proxy_host_port'] ?? 443; | 
| 25 | 25 | // Use HTTP/1.1 instead of HTTP/2 | 
| 26 | 26 | $curl_options[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1; | 
| 27 | -            $this->logger->notice(sprintf('Using HTTP/1.1 CURL Proxy URL: "%s" and port "%s"',  $curl_options[CURLOPT_URL], $curl_options[CURLOPT_URL])); | |
| 27 | +            $this->logger->notice(sprintf('Using HTTP/1.1 CURL Proxy URL: "%s" and port "%s"', $curl_options[CURLOPT_URL], $curl_options[CURLOPT_URL])); | |
| 28 | 28 | } | 
| 29 | 29 |          else { | 
| 30 | 30 | $version_info = curl_version(); | 
| @@ -35,7 +35,7 @@ discard block | ||
| 35 | 35 | |
| 36 | 36 | // Get the UID from the client certificate we use for authentication, this | 
| 37 | 37 | // is set to the bundle ID. | 
| 38 | - $options=$this->getOptions(); | |
| 38 | + $options = $this->getOptions(); | |
| 39 | 39 | $cert_filename = $options['apns.certificate']; | 
| 40 | 40 |          if (strlen($cert_filename) == 0) { | 
| 41 | 41 |              throw new RuntimeException('apns.certificate option not set'); | 
| @@ -47,11 +47,11 @@ discard block | ||
| 47 | 47 | ); | 
| 48 | 48 | } | 
| 49 | 49 | |
| 50 | - $cert=openssl_x509_parse( $cert_file_contents ); | |
| 50 | + $cert = openssl_x509_parse($cert_file_contents); | |
| 51 | 51 |          if (false === $cert) { | 
| 52 | 52 | // Log openssl error information | 
| 53 | 53 |              while ($msg = openssl_error_string()) { | 
| 54 | -                $this->logger->error('openssl_x509_parse(): ' . $msg); | |
| 54 | +                $this->logger->error('openssl_x509_parse(): '.$msg); | |
| 55 | 55 | } | 
| 56 | 56 |              throw new RuntimeException('Error parsing APNS client certificate'); | 
| 57 | 57 | } | 
| @@ -76,11 +76,11 @@ discard block | ||
| 76 | 76 | $authProvider = AuthProvider\Certificate::create($authProviderOptions); | 
| 77 | 77 | |
| 78 | 78 | // Create the push message | 
| 79 | - $alert=Alert::create(); | |
| 79 | + $alert = Alert::create(); | |
| 80 | 80 | $alert->setBody($this->getText()); | 
| 81 | 81 | // Note: It is possible to specify a title and a subtitle: $alert->setTitle() && $alert->setSubtitle() | 
| 82 | 82 | // The tiqr service currently does not implement this. | 
| 83 | - $payload=Payload::create()->setAlert($alert); | |
| 83 | + $payload = Payload::create()->setAlert($alert); | |
| 84 | 84 |          $payload->setSound('default'); | 
| 85 | 85 |          foreach ($this->getCustomProperties() as $name => $value) { | 
| 86 | 86 | $payload->setCustomValue($name, $value); | 
| @@ -91,32 +91,32 @@ discard block | ||
| 91 | 91 | $payload->setMutableContent(true); | 
| 92 | 92 | |
| 93 | 93 |          $this->logger->debug(sprintf('JSON Payload: %s', $payload->toJson())); | 
| 94 | - $notification=new Notification($payload, $this->getAddress()); | |
| 94 | + $notification = new Notification($payload, $this->getAddress()); | |
| 95 | 95 | // Set expiration to 30 seconds from now, same as Message_APNS | 
| 96 | 96 | $now = new DateTime(); | 
| 97 | -        $expirationInstant=$now->add(new DateInterval('PT30S')); | |
| 97 | +        $expirationInstant = $now->add(new DateInterval('PT30S')); | |
| 98 | 98 | $notification->setExpirationAt($expirationInstant); | 
| 99 | 99 | |
| 100 | 100 | // Send the push message | 
| 101 | 101 | $client = new Client($authProvider, $options['apns.environment'] == 'production', $curl_options); | 
| 102 | 102 | $client->addNotification($notification); | 
| 103 | - $responses=$client->push(); | |
| 104 | -        if ( sizeof($responses) != 1) { | |
| 105 | -            $this->logger->warning(sprintf('Unexpected number responses. Expected 1, got %d', sizeof($responses)) ); | |
| 103 | + $responses = $client->push(); | |
| 104 | +        if (sizeof($responses) != 1) { | |
| 105 | +            $this->logger->warning(sprintf('Unexpected number responses. Expected 1, got %d', sizeof($responses))); | |
| 106 | 106 |              if (sizeof($responses) == 0) { | 
| 107 | 107 |                  $this->logger->warning('Could not determine whether the notification was sent'); | 
| 108 | 108 | return; | 
| 109 | 109 | } | 
| 110 | 110 | } | 
| 111 | 111 | /** @var \Pushok\Response $response */ | 
| 112 | - $response = reset($responses); // Get first response from the array | |
| 113 | - $deviceToken=$response->getDeviceToken() ?? ''; | |
| 112 | + $response = reset($responses); // Get first response from the array | |
| 113 | + $deviceToken = $response->getDeviceToken() ?? ''; | |
| 114 | 114 | // A canonical UUID that is the unique ID for the notification. E.g. 123e4567-e89b-12d3-a456-4266554400a0 | 
| 115 | - $apnsId=$response->getApnsId() ?? ''; | |
| 115 | + $apnsId = $response->getApnsId() ?? ''; | |
| 116 | 116 | // Status code. E.g. 200 (Success), 410 (The device token is no longer active for the topic.) | 
| 117 | - $statusCode=$response->getStatusCode(); | |
| 117 | + $statusCode = $response->getStatusCode(); | |
| 118 | 118 |          $this->logger->info(sprintf('Got response with ApnsId "%s", status %s for deviceToken "%s"', $apnsId, $statusCode, $deviceToken)); | 
| 119 | -        if ( strcasecmp($deviceToken, $this->getAddress()) ) { | |
| 119 | +        if (strcasecmp($deviceToken, $this->getAddress())) { | |
| 120 | 120 |          $this->logger->warning(sprintf('Unexpected deviceToken in response. Expected: "%s"; got: "%s"', $this->getAddress(), $deviceToken)); | 
| 121 | 121 | } | 
| 122 | 122 |          if ($statusCode == 200) { | 
| @@ -124,9 +124,9 @@ discard block | ||
| 124 | 124 | return; | 
| 125 | 125 | } | 
| 126 | 126 | |
| 127 | - $reasonPhrase=$response->getReasonPhrase(); // E.g. The device token is no longer active for the topic. | |
| 128 | - $errorReason=$response->getErrorReason(); // E.g. Unregistered | |
| 129 | - $errorDescription=$response->getErrorDescription(); // E.g. The device token is inactive for the specified topic. | |
| 127 | + $reasonPhrase = $response->getReasonPhrase(); // E.g. The device token is no longer active for the topic. | |
| 128 | + $errorReason = $response->getErrorReason(); // E.g. Unregistered | |
| 129 | + $errorDescription = $response->getErrorDescription(); // E.g. The device token is inactive for the specified topic. | |
| 130 | 130 | |
| 131 | 131 |          $this->logger->error(sprintf('Error sending APNS2 push notification. APNS ID: "%s"; deviceToken: "%s"; Error: "%s" "%s" "%s"', $apnsId, $deviceToken, $reasonPhrase, $errorReason, $errorDescription)); | 
| 132 | 132 | throw new RuntimeException( | 
| @@ -111,7 +111,7 @@ discard block | ||
| 111 | 111 | // INVALID_USERID: The client authenticated a different user than the server expected. This error is returned when | 
| 112 | 112 | // the application stated an authentication session specifying the userId and later during the authentication | 
| 113 | 113 | // provides a different userId | 
| 114 | - const AUTH_RESULT_INVALID_USERID = 5; | |
| 114 | + const AUTH_RESULT_INVALID_USERID = 5; | |
| 115 | 115 | |
| 116 | 116 | /** | 
| 117 | 117 | * The default OCRA Suite (RFC 6287) to use for authentication in Tiqr | 
| @@ -220,7 +220,7 @@ discard block | ||
| 220 | 220 | * @param int $version The tiqr protocol version to use (defaults to the latest) | 
| 221 | 221 | * @throws Exception | 
| 222 | 222 | */ | 
| 223 | - public function __construct(LoggerInterface $logger, array $options=array(), int $version = 2) | |
| 223 | + public function __construct(LoggerInterface $logger, array $options = array(), int $version = 2) | |
| 224 | 224 |      { | 
| 225 | 225 | $this->_options = $options; // Used to later get settings for Tiqr_Message_* | 
| 226 | 226 | $this->logger = $logger; | 
| @@ -342,7 +342,7 @@ discard block | ||
| 342 | 342 | case 'APNS': | 
| 343 | 343 | case 'APNS_DIRECT': | 
| 344 | 344 | $apns_version = $this->_options['apns.version'] ?? 2; | 
| 345 | - if ($apns_version !=2) | |
| 345 | + if ($apns_version != 2) | |
| 346 | 346 |                          throw new InvalidArgumentException("Unsupported APNS version '$apns_version'"); | 
| 347 | 347 | $message = new Tiqr_Message_APNS2($this->_options, $this->logger); | 
| 348 | 348 | break; | 
| @@ -361,11 +361,11 @@ discard block | ||
| 361 | 361 | // can use this value to stop offering the authentication to the user. | 
| 362 | 362 | // Use CHALLENGE_EXPIRE - 30 seconds as the maximum timeout to send to the client. This gives the user 30 seconds | 
| 363 | 363 | // before the authentication session expires at the server. Never send an authenticationTimeout of less than 30 seconds. | 
| 364 | - $authenticationTimeout = max( 30, self::CHALLENGE_EXPIRE - 30); | |
| 364 | + $authenticationTimeout = max(30, self::CHALLENGE_EXPIRE - 30); | |
| 365 | 365 | |
| 366 | 366 |              $this->logger->info(sprintf('Creating and sending a %s push notification', $notificationType)); | 
| 367 | 367 | $message->setId(time()); | 
| 368 | -            $message->setText("Please authenticate for " . $this->_name); | |
| 368 | +            $message->setText("Please authenticate for ".$this->_name); | |
| 369 | 369 | $message->setAddress($notificationAddress); | 
| 370 | 370 |              $message->setCustomProperty('challenge', $this->_getChallengeUrl($sessionKey)); | 
| 371 | 371 |              $message->setCustomProperty('authenticationTimeout', $authenticationTimeout); | 
| @@ -422,13 +422,13 @@ discard block | ||
| 422 | 422 | * @return string The authentication sessionKey | 
| 423 | 423 | * @throws Exception when starting the authentication session failed | 
| 424 | 424 | */ | 
| 425 | - public function startAuthenticationSession(string $userId="", string $sessionId="", string $spIdentifier=""): string | |
| 425 | + public function startAuthenticationSession(string $userId = "", string $sessionId = "", string $spIdentifier = ""): string | |
| 426 | 426 |      { | 
| 427 | -        if ($sessionId=="") { | |
| 427 | +        if ($sessionId == "") { | |
| 428 | 428 | $sessionId = session_id(); | 
| 429 | 429 | } | 
| 430 | 430 | |
| 431 | -        if ($spIdentifier=="") { | |
| 431 | +        if ($spIdentifier == "") { | |
| 432 | 432 | $spIdentifier = $this->_identifier; | 
| 433 | 433 | } | 
| 434 | 434 | |
| @@ -437,7 +437,7 @@ discard block | ||
| 437 | 437 | |
| 438 | 438 |          $data = array("sessionId"=>$sessionId, "challenge"=>$challenge, "spIdentifier" => $spIdentifier); | 
| 439 | 439 | |
| 440 | -        if ($userId!="") { | |
| 440 | +        if ($userId != "") { | |
| 441 | 441 | $data["userId"] = $userId; | 
| 442 | 442 | } | 
| 443 | 443 | |
| @@ -461,9 +461,9 @@ discard block | ||
| 461 | 461 | * @return String The enrollment key | 
| 462 | 462 | * @throws Exception when start the enrollement session failed | 
| 463 | 463 | */ | 
| 464 | - public function startEnrollmentSession(string $userId, string $displayName, string $sessionId=""): string | |
| 464 | + public function startEnrollmentSession(string $userId, string $displayName, string $sessionId = ""): string | |
| 465 | 465 |      { | 
| 466 | -        if ($sessionId=="") { | |
| 466 | +        if ($sessionId == "") { | |
| 467 | 467 | $sessionId = session_id(); | 
| 468 | 468 | } | 
| 469 | 469 | $enrollmentKey = $this->_uniqueSessionKey(); | 
| @@ -483,9 +483,9 @@ discard block | ||
| 483 | 483 | * @param string $sessionId The application's session identifier (defaults to php session) | 
| 484 | 484 | * @throws Exception when resetting the session failed | 
| 485 | 485 | */ | 
| 486 | - public function resetEnrollmentSession(string $sessionId=""): void | |
| 486 | + public function resetEnrollmentSession(string $sessionId = ""): void | |
| 487 | 487 |      { | 
| 488 | -        if ($sessionId=="") { | |
| 488 | +        if ($sessionId == "") { | |
| 489 | 489 | $sessionId = session_id(); | 
| 490 | 490 | } | 
| 491 | 491 | |
| @@ -520,9 +520,9 @@ discard block | ||
| 520 | 520 | * | 
| 521 | 521 | * @throws Exception when an error communicating with the state storage backend was detected | 
| 522 | 522 | */ | 
| 523 | - public function getEnrollmentStatus(string $sessionId=""): int | |
| 523 | + public function getEnrollmentStatus(string $sessionId = ""): int | |
| 524 | 524 |      {  | 
| 525 | -        if ($sessionId=="") { | |
| 525 | +        if ($sessionId == "") { | |
| 526 | 526 | $sessionId = session_id(); | 
| 527 | 527 | } | 
| 528 | 528 | $status = $this->_getStateValue(self::PREFIX_ENROLLMENT_STATUS, $sessionId); | 
| @@ -696,7 +696,7 @@ discard block | ||
| 696 | 696 |              if (NULL === $data) { | 
| 697 | 697 |                  throw new RuntimeException('Enrollment secret not found'); | 
| 698 | 698 | } | 
| 699 | -            if ( !is_array($data) || !is_string($data["userId"] ?? NULL)) { | |
| 699 | +            if (!is_array($data) || !is_string($data["userId"] ?? NULL)) { | |
| 700 | 700 |                  throw new RuntimeException('Invalid enrollment data'); | 
| 701 | 701 | } | 
| 702 | 702 | |
| @@ -736,7 +736,7 @@ discard block | ||
| 736 | 736 | $this->_setEnrollmentStatus($data["sessionId"], self::ENROLLMENT_STATUS_FINALIZED); | 
| 737 | 737 |              } else { | 
| 738 | 738 | $this->logger->error( | 
| 739 | - 'Enrollment status is not finalized, enrollmentsecret was not found in state storage. ' . | |
| 739 | + 'Enrollment status is not finalized, enrollmentsecret was not found in state storage. '. | |
| 740 | 740 | 'Warning! the method will still return "true" as a result.' | 
| 741 | 741 | ); | 
| 742 | 742 | } | 
| @@ -805,9 +805,9 @@ discard block | ||
| 805 | 805 | throw $e; | 
| 806 | 806 | } | 
| 807 | 807 | |
| 808 | - $sessionId = $state["sessionId"] ?? NULL; // Application's sessionId | |
| 809 | - $challenge = $state["challenge"] ?? NULL; // The challenge we sent to the Tiqr client | |
| 810 | -        if (!is_string($sessionId) || (!is_string($challenge)) ) { | |
| 808 | + $sessionId = $state["sessionId"] ?? NULL; // Application's sessionId | |
| 809 | + $challenge = $state["challenge"] ?? NULL; // The challenge we sent to the Tiqr client | |
| 810 | +        if (!is_string($sessionId) || (!is_string($challenge))) { | |
| 811 | 811 |              throw new RuntimeException('Invalid state for state storage'); | 
| 812 | 812 | } | 
| 813 | 813 | |
| @@ -816,7 +816,7 @@ discard block | ||
| 816 | 816 | $challengeUserId = $state["userId"] ?? NULL; | 
| 817 | 817 | |
| 818 | 818 | // If the application requested a specific userId, verify that that is that userId that we're now authenticating | 
| 819 | -        if ($challengeUserId!==NULL && ($userId !== $challengeUserId)) { | |
| 819 | +        if ($challengeUserId !== NULL && ($userId !== $challengeUserId)) { | |
| 820 | 820 | $this->logger->error( | 
| 821 | 821 |                  sprintf('Authentication failed: the requested userId "%s" does not match userId "%s" that is being authenticated', | 
| 822 | 822 | $challengeUserId, $userId) | 
| @@ -864,9 +864,9 @@ discard block | ||
| 864 | 864 | * | 
| 865 | 865 | * @throws Exception when there was an error communicating with the storage backed | 
| 866 | 866 | */ | 
| 867 | - public function logout(string $sessionId=""): void | |
| 867 | + public function logout(string $sessionId = ""): void | |
| 868 | 868 |      { | 
| 869 | -        if ($sessionId=="") { | |
| 869 | +        if ($sessionId == "") { | |
| 870 | 870 | $sessionId = session_id(); | 
| 871 | 871 | } | 
| 872 | 872 | |
| @@ -906,9 +906,9 @@ discard block | ||
| 906 | 906 | * | 
| 907 | 907 | * Does not throw | 
| 908 | 908 | */ | 
| 909 | - public function getAuthenticatedUser(string $sessionId=""): ?string | |
| 909 | + public function getAuthenticatedUser(string $sessionId = ""): ?string | |
| 910 | 910 |      { | 
| 911 | -        if ($sessionId=="") { | |
| 911 | +        if ($sessionId == "") { | |
| 912 | 912 |              $this->logger->debug('Using the PHP session id, as no session id was provided'); | 
| 913 | 913 | $sessionId = session_id(); | 
| 914 | 914 | } | 
| @@ -952,22 +952,22 @@ discard block | ||
| 952 | 952 | $challenge = $state["challenge"] ?? ''; | 
| 953 | 953 | $spIdentifier = $state["spIdentifier"] ?? ''; | 
| 954 | 954 | |
| 955 | -        if ( (strpos($this->_protocolAuth, 'https://') === 0) || (strpos($this->_protocolAuth, 'http://') === 0) ) { | |
| 955 | +        if ((strpos($this->_protocolAuth, 'https://') === 0) || (strpos($this->_protocolAuth, 'http://') === 0)) { | |
| 956 | 956 | // Create universal Link | 
| 957 | - $parameters=array(); | |
| 957 | + $parameters = array(); | |
| 958 | 958 |              if (!is_null($userId)) { | 
| 959 | - $parameters[]='u='.urlencode($userId); | |
| 959 | + $parameters[] = 'u='.urlencode($userId); | |
| 960 | 960 | } | 
| 961 | - $parameters[]='s='.urlencode($sessionKey); | |
| 962 | - $parameters[]='q='.urlencode($challenge); | |
| 963 | - $parameters[]='i='.urlencode($this->getIdentifier()); | |
| 964 | - $parameters[]='v='.urlencode($this->_protocolVersion); | |
| 961 | + $parameters[] = 's='.urlencode($sessionKey); | |
| 962 | + $parameters[] = 'q='.urlencode($challenge); | |
| 963 | + $parameters[] = 'i='.urlencode($this->getIdentifier()); | |
| 964 | + $parameters[] = 'v='.urlencode($this->_protocolVersion); | |
| 965 | 965 |              return $this->_protocolAuth.'?'.implode('&', $parameters); | 
| 966 | 966 | } | 
| 967 | 967 | |
| 968 | 968 | // Create custom URL scheme | 
| 969 | 969 | // Last bit is the spIdentifier | 
| 970 | - return $this->_protocolAuth."://".(!is_null($userId)?urlencode($userId).'@':'').$this->getIdentifier()."/".$sessionKey."/".$challenge."/".urlencode($spIdentifier)."/".$this->_protocolVersion; | |
| 970 | + return $this->_protocolAuth."://".(!is_null($userId) ?urlencode($userId).'@' : '').$this->getIdentifier()."/".$sessionKey."/".$challenge."/".urlencode($spIdentifier)."/".$this->_protocolVersion; | |
| 971 | 971 | } | 
| 972 | 972 | |
| 973 | 973 | /** | 
| @@ -978,7 +978,7 @@ discard block | ||
| 978 | 978 |      { | 
| 979 | 979 | // The are two formats see: https://tiqr.org/technical/protocol/ | 
| 980 | 980 | |
| 981 | -        if ( (strpos($this->_protocolEnroll, 'https://') === 0) || (strpos($this->_protocolEnroll, 'http://') === 0) ) { | |
| 981 | +        if ((strpos($this->_protocolEnroll, 'https://') === 0) || (strpos($this->_protocolEnroll, 'http://') === 0)) { | |
| 982 | 982 | // Create universal Link | 
| 983 | 983 | return $this->_protocolEnroll.'?metadata='.urlencode($metadataUrl); | 
| 984 | 984 | } | 
| @@ -997,7 +997,7 @@ discard block | ||
| 997 | 997 | protected function _uniqueSessionKey(): string | 
| 998 | 998 |      { | 
| 999 | 999 | |
| 1000 | - return bin2hex( Tiqr_Random::randomBytes(self::SESSION_KEY_LENGTH_BYTES) ); | |
| 1000 | + return bin2hex(Tiqr_Random::randomBytes(self::SESSION_KEY_LENGTH_BYTES)); | |
| 1001 | 1001 | } | 
| 1002 | 1002 | |
| 1003 | 1003 | /** | 
| @@ -1028,7 +1028,7 @@ discard block | ||
| 1028 | 1028 | */ | 
| 1029 | 1029 |      protected function _setStateValue(string $key_prefix, string $key, $value, int $expire): void { | 
| 1030 | 1030 | $this->_stateStorage->setValue( | 
| 1031 | - $key_prefix . $this->_hashKey($key), | |
| 1031 | + $key_prefix.$this->_hashKey($key), | |
| 1032 | 1032 | $value, | 
| 1033 | 1033 | $expire | 
| 1034 | 1034 | ); | 
| @@ -1045,7 +1045,7 @@ discard block | ||
| 1045 | 1045 | |
| 1046 | 1046 |      protected function _getStateValue(string $key_prefix, string $key) { | 
| 1047 | 1047 | return $this->_stateStorage->getValue( | 
| 1048 | - $key_prefix . $this->_hashKey($key) | |
| 1048 | + $key_prefix.$this->_hashKey($key) | |
| 1049 | 1049 | ); | 
| 1050 | 1050 | } | 
| 1051 | 1051 | |
| @@ -1059,7 +1059,7 @@ discard block | ||
| 1059 | 1059 | */ | 
| 1060 | 1060 |      protected function _unsetStateValue(string $key_prefix, string $key): void { | 
| 1061 | 1061 | $this->_stateStorage->unsetValue( | 
| 1062 | - $key_prefix . $this->_hashKey($key) | |
| 1062 | + $key_prefix.$this->_hashKey($key) | |
| 1063 | 1063 | ); | 
| 1064 | 1064 | } | 
| 1065 | 1065 | |