From af5558fe6c57688ac834d902d099b5baeb8db811 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ou=C5=A1ek?= <brousek@ics.muni.cz>
Date: Wed, 28 Sep 2022 22:47:39 +0200
Subject: [PATCH] style: PSR12

---
 config-templates/module_campusmultiauth.php |   4 +-
 lib/Auth/Source/Campusidp.php               | 148 ++++++++++++++------
 themes/campus/privacyidea/LoginForm.php     | 118 ++++++++++------
 www/idpSearch.php                           |   4 +-
 www/selectsource.php                        |  15 +-
 5 files changed, 199 insertions(+), 90 deletions(-)

diff --git a/config-templates/module_campusmultiauth.php b/config-templates/module_campusmultiauth.php
index 7c0e5c5..455c764 100644
--- a/config-templates/module_campusmultiauth.php
+++ b/config-templates/module_campusmultiauth.php
@@ -1,11 +1,11 @@
 <?php
 
-declare(strict_types=1);
-
 /**
  * An example configuration of the login page
  */
 
+declare(strict_types=1);
+
 $config = [
     'components' => [
         [
diff --git a/lib/Auth/Source/Campusidp.php b/lib/Auth/Source/Campusidp.php
index b094286..f84b8b6 100644
--- a/lib/Auth/Source/Campusidp.php
+++ b/lib/Auth/Source/Campusidp.php
@@ -92,7 +92,8 @@ class Campusidp extends Source
 
         $this->sources = [];
 
-        $this->userPassSourceName = !empty($config['userPassSource']['name']) ? $config['userPassSource']['name'] : 'campus-userpass';
+        $this->userPassSourceName = !empty($config['userPassSource']['name'])
+            ? $config['userPassSource']['name'] : 'campus-userpass';
 
         $userPassClassRef = [];
         if (!empty($config['userPassSource']['AuthnContextClassRef'])) {
@@ -182,10 +183,12 @@ class Campusidp extends Source
         $session->setData(self::SESSION_SOURCE, $state[self::AUTHID], $authId, Session::DATA_TIMEOUT_SESSION_END);
 
         try {
-            if (!empty($_POST['username']) && !empty($_POST['password']) && is_subclass_of(
-                $as,
-                '\SimpleSAML\Module\core\Auth\UserPassBase'
-            )) {
+            if (
+                !empty($_POST['username']) && !empty($_POST['password']) && is_subclass_of(
+                    $as,
+                    '\SimpleSAML\Module\core\Auth\UserPassBase'
+                )
+            ) {
                 $state[UserPassBase::AUTHID] = $authId;
 
                 try {
@@ -346,14 +349,20 @@ class Campusidp extends Source
                         case self::ASSURANCE_CERTIFICATION:
                             $isFirst ?
                                 $result = array_merge($result, self::getAssuranceCertificationIdps($value, $metadata)) :
-                                $result = array_intersect($result, self::getAssuranceCertificationIdps($value, $metadata));
+                                $result = array_intersect(
+                                    $result,
+                                    self::getAssuranceCertificationIdps($value, $metadata)
+                                );
                             $isFirst = false;
 
                             break;
                         case self::REGISTRATION_AUTHORITY:
                             $isFirst ?
                                 $result = array_merge($result, self::getRegistrationAuthorityIdps($value, $metadata)) :
-                                $result = array_intersect($result, self::getRegistrationAuthorityIdps($value, $metadata));
+                                $result = array_intersect(
+                                    $result,
+                                    self::getRegistrationAuthorityIdps($value, $metadata)
+                                );
                             $isFirst = false;
                             break;
                         default:
@@ -366,14 +375,26 @@ class Campusidp extends Source
                 switch ($type) {
                     case self::ENTITY_CATEGORY:
                         $isFirst ?
-                            $result = array_merge($result, self::getEntityCategoryIdps([self::CONTAINS => $item], $metadata)) :
-                            $result = array_intersect($result, self::getEntityCategoryIdps([self::CONTAINS => $item], $metadata));
+                            $result = array_merge(
+                                $result,
+                                self::getEntityCategoryIdps([self::CONTAINS => $item], $metadata)
+                            ) :
+                            $result = array_intersect(
+                                $result,
+                                self::getEntityCategoryIdps([self::CONTAINS => $item], $metadata)
+                            );
                         $isFirst = false;
                         break;
                     case self::ASSURANCE_CERTIFICATION:
                         $isFirst ?
-                            $result = array_merge($result, self::getAssuranceCertificationIdps([self::CONTAINS => $item], $metadata)) :
-                            $result = array_intersect($result, self::getAssuranceCertificationIdps([self::CONTAINS => $item], $metadata));
+                            $result = array_merge(
+                                $result,
+                                self::getAssuranceCertificationIdps([self::CONTAINS => $item], $metadata)
+                            ) :
+                            $result = array_intersect(
+                                $result,
+                                self::getAssuranceCertificationIdps([self::CONTAINS => $item], $metadata)
+                            );
                         $isFirst = false;
                         break;
                     default:
@@ -420,16 +441,28 @@ class Campusidp extends Source
             foreach ($claim as $item) {
                 switch ($type) {
                     case self::ENTITY_CATEGORY:
-                        $result = array_merge($result, self::getEntityCategoryIdps([self::CONTAINS => $item], $metadata));
+                        $result = array_merge(
+                            $result,
+                            self::getEntityCategoryIdps([self::CONTAINS => $item], $metadata)
+                        );
                         break;
                     case self::ASSURANCE_CERTIFICATION:
-                        $result = array_merge($result, self::getAssuranceCertificationIdps([self::CONTAINS => $item], $metadata));
+                        $result = array_merge(
+                            $result,
+                            self::getAssuranceCertificationIdps([self::CONTAINS => $item], $metadata)
+                        );
                         break;
                     case self::REGISTRATION_AUTHORITY:
-                        $result = array_merge($result, self::getRegistrationAuthorityIdps([self::EQUALS => $item], $metadata));
+                        $result = array_merge(
+                            $result,
+                            self::getRegistrationAuthorityIdps([self::EQUALS => $item], $metadata)
+                        );
                         break;
                     case self::ENTITYID:
-                        $result = array_merge($result, self::getEntityidIdp([self::EQUALS => $item], $metadata));
+                        $result = array_merge(
+                            $result,
+                            self::getEntityidIdp([self::EQUALS => $item], $metadata)
+                        );
                         break;
                     default:
                         break;
@@ -446,10 +479,16 @@ class Campusidp extends Source
 
         switch (array_key_first($claim)) {
             case self::ALL_OF:
-                $result = array_merge($result, self::getAllOfIdps($claim[self::ALL_OF], $metadata, self::ENTITY_CATEGORY));
+                $result = array_merge(
+                    $result,
+                    self::getAllOfIdps($claim[self::ALL_OF], $metadata, self::ENTITY_CATEGORY)
+                );
                 break;
             case self::ANY_OF:
-                $result = array_merge($result, self::getAnyOfIdps($claim[self::ANY_OF], $metadata, self::ENTITY_CATEGORY));
+                $result = array_merge(
+                    $result,
+                    self::getAnyOfIdps($claim[self::ANY_OF], $metadata, self::ENTITY_CATEGORY)
+                );
                 break;
             case self::CONTAINS:
                 foreach ($metadata as $entityid => $idpMetadata) {
@@ -473,10 +512,16 @@ class Campusidp extends Source
 
         switch (array_key_first($claim)) {
             case self::ALL_OF:
-                $result = array_merge($result, self::getAllOfIdps($claim[self::ALL_OF], $metadata, self::ASSURANCE_CERTIFICATION));
+                $result = array_merge(
+                    $result,
+                    self::getAllOfIdps($claim[self::ALL_OF], $metadata, self::ASSURANCE_CERTIFICATION)
+                );
                 break;
             case self::ANY_OF:
-                $result = array_merge($result, self::getAnyOfIdps($claim[self::ANY_OF], $metadata, self::ASSURANCE_CERTIFICATION));
+                $result = array_merge(
+                    $result,
+                    self::getAnyOfIdps($claim[self::ANY_OF], $metadata, self::ASSURANCE_CERTIFICATION)
+                );
                 break;
             case self::CONTAINS:
                 foreach ($metadata as $entityid => $idpMetadata) {
@@ -500,20 +545,27 @@ class Campusidp extends Source
 
         switch (array_key_first($claim)) {
             case self::ANY_OF:
-                $result = array_merge($result, self::getAnyOfIdps($claim[self::ANY_OF], $metadata, self::REGISTRATION_AUTHORITY));
+                $result = array_merge(
+                    $result,
+                    self::getAnyOfIdps($claim[self::ANY_OF], $metadata, self::REGISTRATION_AUTHORITY)
+                );
                 break;
             case self::EQUALS:
                 foreach ($metadata as $entityid => $idpMetadata) {
-                    if (!empty($idpMetadata['RegistrationInfo']['registrationAuthority']) &&
-                        self::equals($idpMetadata['RegistrationInfo']['registrationAuthority'], $claim[self::EQUALS])) {
+                    if (
+                        !empty($idpMetadata['RegistrationInfo']['registrationAuthority']) &&
+                        self::equals($idpMetadata['RegistrationInfo']['registrationAuthority'], $claim[self::EQUALS])
+                    ) {
                         $result[] = $entityid;
                     }
                 }
                 break;
             case self::MATCHES:
                 foreach ($metadata as $entityid => $idpMetadata) {
-                    if (!empty($idpMetadata['RegistrationInfo']['registrationAuthority']) &&
-                        self::matches($idpMetadata['RegistrationInfo']['registrationAuthority'], $claim[self::MATCHES])) {
+                    if (
+                        !empty($idpMetadata['RegistrationInfo']['registrationAuthority']) &&
+                        self::matches($idpMetadata['RegistrationInfo']['registrationAuthority'], $claim[self::MATCHES])
+                    ) {
                         $result[] = $entityid;
                     }
                 }
@@ -701,11 +753,13 @@ class Campusidp extends Source
         $endColComponent = -1;
 
         for ($i = 0; $i < count($config['components']); $i++) {
-            if ($config['components'][$i]['name'] === 'local_login' && in_array(
-                $config['components'][$i]['entityid'],
-                $idphint,
-                true
-            )) {
+            if (
+                $config['components'][$i]['name'] === 'local_login' && in_array(
+                    $config['components'][$i]['entityid'],
+                    $idphint,
+                    true
+                )
+            ) {
                 $componentsToDisplay[] = $i;
             }
 
@@ -749,33 +803,41 @@ class Campusidp extends Source
         foreach ($metadata as $entityid => $idpentry) {
             if (!empty($idpentry['name']) && is_array($idpentry['name'])) {
                 foreach ($idpentry['name'] as $key => $value) {
-                    if (str_contains(
-                        $transliterator->transliterate($value),
-                        $transliterator->transliterate($searchTerm)
-                    )) {
+                    if (
+                        str_contains(
+                            $transliterator->transliterate($value),
+                            $transliterator->transliterate($searchTerm)
+                        )
+                    ) {
                         $filteredMetadata[$entityid] = $idpentry;
                         break;
                     }
                 }
             }
 
-            if (!in_array($idpentry, $filteredMetadata, true) && !empty($idpentry['description']) && is_array(
-                $idpentry['description']
-            )) {
+            if (
+                !in_array($idpentry, $filteredMetadata, true) && !empty($idpentry['description']) && is_array(
+                    $idpentry['description']
+                )
+            ) {
                 foreach ($idpentry['description'] as $key => $value) {
-                    if (str_contains(
-                        $transliterator->transliterate($value),
-                        $transliterator->transliterate($searchTerm)
-                    )) {
+                    if (
+                        str_contains(
+                            $transliterator->transliterate($value),
+                            $transliterator->transliterate($searchTerm)
+                        )
+                    ) {
                         $filteredMetadata[$entityid] = $idpentry;
                         break;
                     }
                 }
             }
 
-            if (!in_array($idpentry, $filteredMetadata, true) && !empty($idpentry['url']) && is_array(
-                $idpentry['url']
-            )) {
+            if (
+                !in_array($idpentry, $filteredMetadata, true) && !empty($idpentry['url']) && is_array(
+                    $idpentry['url']
+                )
+            ) {
                 foreach ($idpentry['url'] as $key => $value) {
                     if (str_contains(strtolower($value), strtolower($searchTerm))) {
                         $filteredMetadata[$entityid] = $idpentry;
diff --git a/themes/campus/privacyidea/LoginForm.php b/themes/campus/privacyidea/LoginForm.php
index 4ad9cef..1fefd03 100644
--- a/themes/campus/privacyidea/LoginForm.php
+++ b/themes/campus/privacyidea/LoginForm.php
@@ -1,4 +1,6 @@
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
 
 use SimpleSAML\Module;
 
@@ -59,7 +61,8 @@ if ($this->data['errorCode'] !== null) {
                                     }
                                     ?></p>
                                     <p>
-                                        <button id="useWebAuthnButton" name="useWebAuthnButton" class="btn btn-primary btn-s" type="button">
+                                        <button id="useWebAuthnButton" name="useWebAuthnButton"
+                                          class="btn btn-primary btn-s" type="button">
                                             <span><?php echo $this->t('{privacyidea:privacyidea:webauthn}'); ?></span>
                                         </button>
                                     </p>
@@ -72,16 +75,28 @@ if ($this->data['errorCode'] !== null) {
                                     <p><?php echo $this->t('{campusmultiauth:otp_help}'); ?></p>
                                     <div class="form-inline">
                                         <p class="size--m--4-4 size--l--6-12">
-                                            <label for="otp" class="sr-only"><?php echo $this->t('{privacyidea:privacyidea:otp}'); ?></label>
+                                            <label for="otp" class="sr-only">
+                                                <?php echo $this->t('{privacyidea:privacyidea:otp}'); ?>
+                                            </label>
                                             <span class="inp-fix">
-                                                <input id="otp" name="otp" tabindex="1" value="" class="text inp-text" autocomplete="one-time-code" type="number" inputmode="numeric" pattern="[0-9]{6,}" required placeholder="<?php echo htmlspecialchars($otpHint, ENT_QUOTES); ?>"<?php if ($this->data['noAlternatives']) {
+                                                <input id="otp" name="otp" tabindex="1" value="" class="text inp-text"
+                                                autocomplete="one-time-code" type="number" inputmode="numeric"
+                                                pattern="[0-9]{6,}" required
+                                                placeholder="<?php echo htmlspecialchars($otpHint, ENT_QUOTES); ?>"
+                                                <?php if ($this->data['noAlternatives']) {
                                                     echo ' autofocus';
                                                 } ?> />
                                             </span>
                                         </p>
                                         <p>
-                                            <button id="submitButton" tabindex="1" class="rc-button rc-button-submit btn btn-primary btn-s nowrap" type="submit" name="Submit">
-                                                <span><?php echo htmlspecialchars($this->t('{login:login_button}'), ENT_QUOTES); ?></span>
+                                            <button id="submitButton" tabindex="1"
+                                              class="rc-button rc-button-submit btn btn-primary btn-s nowrap"
+                                              type="submit" name="Submit">
+                                                <span>
+                                                    <?php echo htmlspecialchars(
+                                                        $this->t('{login:login_button}'),
+                                                        ENT_QUOTES
+                                                    ); ?></span>
                                             </button>
                                         </p>
                                     </div>
@@ -90,33 +105,45 @@ if ($this->data['errorCode'] !== null) {
 
                                 <!-- Undefined index is suppressed and the default is used for these values -->
                                 <input id="mode" type="hidden" name="mode" value="otp"
-                                       data-preferred="<?php echo htmlspecialchars($this->data['mode'], ENT_QUOTES); ?>"/>
+                                data-preferred="<?php echo htmlspecialchars($this->data['mode'], ENT_QUOTES); ?>"/>
 
                                 <input id="pushAvailable" type="hidden" name="pushAvailable"
-                                       value="<?php echo ($this->data['pushAvailable'] ?? false) ? 'true' : ''; ?>"/>
+                                value="<?php echo ($this->data['pushAvailable'] ?? false) ? 'true' : ''; ?>"/>
 
                                 <input id="otpAvailable" type="hidden" name="otpAvailable"
-                                       value="<?php echo ($this->data['otpAvailable'] ?? true) ? 'true' : ''; ?>"/>
+                                value="<?php echo ($this->data['otpAvailable'] ?? true) ? 'true' : ''; ?>"/>
 
                                 <input id="webAuthnSignRequest" type="hidden" name="webAuthnSignRequest"
-                                       value='<?php echo htmlspecialchars($this->data['webAuthnSignRequest'] ?? '', ENT_QUOTES); ?>'/>
+                                value='<?php echo htmlspecialchars(
+                                    $this->data['webAuthnSignRequest'] ?? '',
+                                    ENT_QUOTES
+                                ); ?>'/>
 
                                 <input id="u2fSignRequest" type="hidden" name="u2fSignRequest"
-                                       value='<?php echo htmlspecialchars($this->data['u2fSignRequest'] ?? '', ENT_QUOTES); ?>'/>
+                                value='<?php echo htmlspecialchars(
+                                    $this->data['u2fSignRequest'] ?? '',
+                                    ENT_QUOTES
+                                ); ?>'/>
 
                                 <input id="modeChanged" type="hidden" name="modeChanged" value=""/>
                                 <input id="step" type="hidden" name="step"
-                                       value="<?php echo htmlspecialchars(strval(($this->data['step'] ?? null) ?: 2), ENT_QUOTES); ?>"/>
+                                value="<?php echo htmlspecialchars(
+                                    strval(($this->data['step'] ?? null) ?: 2),
+                                    ENT_QUOTES
+                                ); ?>"/>
 
                                 <input id="webAuthnSignResponse" type="hidden" name="webAuthnSignResponse" value=""/>
                                 <input id="u2fSignResponse" type="hidden" name="u2fSignResponse" value=""/>
                                 <input id="origin" type="hidden" name="origin" value=""/>
                                 <input id="loadCounter" type="hidden" name="loadCounter"
-                                       value="<?php echo htmlspecialchars(strval(($this->data['loadCounter'] ?? null) ?: 1), ENT_QUOTES); ?>"/>
+                                value="<?php echo htmlspecialchars(
+                                    strval(($this->data['loadCounter'] ?? null) ?: 1),
+                                    ENT_QUOTES
+                                ); ?>"/>
 
                                 <!-- Additional input to persist the message -->
                                 <input type="hidden" name="message"
-                                       value="<?php echo htmlspecialchars($this->data['message'] ?? '', ENT_QUOTES); ?>"/>
+                                value="<?php echo htmlspecialchars($this->data['message'] ?? '', ENT_QUOTES); ?>"/>
 
                                 <?php
                                 // If enrollToken load QR Code
@@ -129,7 +156,7 @@ if ($this->data['errorCode'] !== null) {
                                     </div>
                                     <?php
                                 }
-?>
+                                ?>
                             </div>
 
                             <?php
@@ -137,7 +164,9 @@ if ($this->data['errorCode'] !== null) {
                             if (array_key_exists('organizations', $this->data)) {
                                 ?>
                                 <div class="identifier-shown">
-                                    <label for="organization"><?php echo htmlspecialchars($this->t('{login:organization}')); ?></label>
+                                    <label for="organization">
+                                        <?php echo htmlspecialchars($this->t('{login:organization}')); ?>
+                                    </label>
                                     <select id="organization" name="organization" tabindex="3">
                                         <?php
                                         if (array_key_exists('selectedOrg', $this->data)) {
@@ -146,25 +175,25 @@ if ($this->data['errorCode'] !== null) {
                                             $selectedOrg = null;
                                         }
 
-                                foreach ($this->data['organizations'] as $orgId => $orgDesc) {
-                                    if (is_array($orgDesc)) {
-                                        $orgDesc = $this->t($orgDesc);
-                                    }
-
-                                    if ($orgId === $selectedOrg) {
-                                        $selected = 'selected="selected" ';
-                                    } else {
-                                        $selected = '';
-                                    }
-
-                                    echo '<option ' . $selected . 'value="' . htmlspecialchars(
-                                        $orgId,
-                                        ENT_QUOTES
-                                    ) . '">' . htmlspecialchars($orgDesc) . '</option>';
-                                } ?>
+                                        foreach ($this->data['organizations'] as $orgId => $orgDesc) {
+                                            if (is_array($orgDesc)) {
+                                                $orgDesc = $this->t($orgDesc);
+                                            }
+
+                                            if ($orgId === $selectedOrg) {
+                                                $selected = 'selected="selected" ';
+                                            } else {
+                                                $selected = '';
+                                            }
+
+                                            echo '<option ' . $selected . 'value="' . htmlspecialchars(
+                                                $orgId,
+                                                ENT_QUOTES
+                                            ) . '">' . htmlspecialchars($orgDesc) . '</option>';
+                                        } ?>
                                     </select>
                                 </div>
-                            <?php
+                                <?php
                             } ?>
                         </div> <!-- focused -->
                     </div> <!-- slide-out-->
@@ -175,7 +204,9 @@ if ($this->data['errorCode'] !== null) {
             // Logout
             if (($this->data['showLogout'] ?? true) && isset($this->data['LogoutURL'])) { ?>
                 <p>
-                    <a href="<?php echo htmlspecialchars($this->data['LogoutURL']); ?>"><?php echo $this->t('{status:logout}'); ?></a>
+                    <a href="<?php echo htmlspecialchars($this->data['LogoutURL']); ?>">
+                        <?php echo $this->t('{status:logout}'); ?>
+                    </a>
                 </p>
             <?php } ?>
         </div>  <!-- End of login -->
@@ -201,12 +232,19 @@ if (!empty($this->data['links'])) {
 
     <meta id="privacyidea-step" name="privacyidea-step" content="<?php echo $this->data['step']; ?>">
 
-    <meta id="privacyidea-translations" name="privacyidea-translations" content="<?php echo htmlspecialchars(json_encode($this->data['translations'])); ?>">
-
-    <script src="<?php echo htmlspecialchars(Module::getModuleUrl('privacyidea/js/loginform.js'), ENT_QUOTES); ?>">
-    </script>
-    <script src="<?php echo htmlspecialchars(Module::getModuleUrl('campusmultiauth/resources/privacyidea.js'), ENT_QUOTES); ?>">
-    </script>
+    <meta id="privacyidea-translations" name="privacyidea-translations"
+      content="<?php echo htmlspecialchars(json_encode($this->data['translations'])); ?>">
+
+    <script src="<?php echo htmlspecialchars(
+        Module::getModuleUrl('privacyidea/js/loginform.js'),
+        ENT_QUOTES
+    );
+                ?>"></script>
+    <script src="<?php echo htmlspecialchars(
+        Module::getModuleUrl('campusmultiauth/resources/privacyidea.js'),
+        ENT_QUOTES
+    );
+                ?>"></script>
 
 <?php
 $this->includeAtTemplateBase('includes/footer.php');
diff --git a/www/idpSearch.php b/www/idpSearch.php
index 5f5a4b1..0276ec1 100644
--- a/www/idpSearch.php
+++ b/www/idpSearch.php
@@ -24,7 +24,9 @@ if (!empty($_GET['idphint']) && !isset($_GET['index'])) {
     $searchBox = $config['components'][$index];
 
     if (!empty($_GET['aarc_discovery_hint_uri'])) {
-        $idphint = Campusidp::getHintedIdps(['aarc_discovery_hint_uri' => json_decode($_GET['aarc_discovery_hint_uri'])]);
+        $idphint = Campusidp::getHintedIdps([
+            'aarc_discovery_hint_uri' => json_decode($_GET['aarc_discovery_hint_uri'])
+        ]);
     } elseif (!empty($_GET['aarc_discovery_hint'])) {
         $idphint = Campusidp::getHintedIdps(['aarc_discovery_hint' => json_decode($_GET['aarc_discovery_hint'])]);
     } elseif (!empty($_GET['idphint'])) {
diff --git a/www/selectsource.php b/www/selectsource.php
index c588959..7ff2b11 100644
--- a/www/selectsource.php
+++ b/www/selectsource.php
@@ -38,7 +38,10 @@ if ($hintedIdps !== null || array_key_exists('idphint', $state)) {
     if ($hintedIdps !== null && count($hintedIdps) === 1) {
         $state['saml:idp'] = array_pop($hintedIdps);
         Campusidp::delegateAuthentication($state[Campusidp::SP_SOURCE_NAME], $state);
-    } elseif ($hintedIdps === null && array_key_exists('idphint', $state) && count(explode(',', $state['idphint'])) === 1) {
+    } elseif (
+        $hintedIdps === null && array_key_exists('idphint', $state)
+        && count(explode(',', $state['idphint'])) === 1
+    ) {
         $state['saml:idp'] = urldecode($parts[0]);
         Campusidp::delegateAuthentication($state[Campusidp::SP_SOURCE_NAME], $state);
     } else {
@@ -89,9 +92,11 @@ if (array_key_exists('source', $_POST)) {
     if (array_key_exists('searchbox', $_POST)) {
         $state['saml:idp'] = $_POST['searchbox'];
 
-        if (!empty($metadata[$_POST['searchbox']]) &&
+        if (
+            !empty($metadata[$_POST['searchbox']]) &&
             !empty($wayfConfig['components'][$_POST['componentIndex']]) &&
-            $wayfConfig['components'][$_POST['componentIndex']]['name'] === 'searchbox') {
+            $wayfConfig['components'][$_POST['componentIndex']]['name'] === 'searchbox'
+        ) {
             $prevIdps = Campusidp::getCookie(Campusidp::COOKIE_PREVIOUS_IDPS) === null ?
                 [] :
                 json_decode(
@@ -162,7 +167,9 @@ if (!empty($_POST['q'])) {
         $ch,
         CURLOPT_URL,
         Module::getModuleURL(
-            'campusmultiauth/idpSearch.php?q=' . $_POST['q'] . '&index=' . $_POST['componentIndex'] . '&language=' . $_POST['currentLanguage']
+            'campusmultiauth/idpSearch.php?q=' . $_POST['q']
+            . '&index=' . $_POST['componentIndex']
+            . '&language=' . $_POST['currentLanguage']
         )
     );
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-- 
GitLab