From a5f8c04cde7273f0e69a795df27565341ee281f2 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Fri, 4 Oct 2019 10:15:21 +0200
Subject: [PATCH] PSR-12

---
 bin/importPdoMetadata.php                |  8 ++---
 bin/initMDSPdo.php                       |  8 ++---
 bin/memcacheSync.php                     | 27 ++++++++--------
 bin/pwgen.php                            |  6 ++--
 bin/translateAttributes.php              | 41 ++++++++++++------------
 config-templates/authsources.php         |  3 +-
 metadata-templates/saml20-idp-hosted.php |  1 +
 metadata-templates/saml20-idp-remote.php |  1 +
 metadata-templates/saml20-sp-remote.php  |  1 +
 metadata-templates/shib13-idp-hosted.php |  1 +
 metadata-templates/shib13-idp-remote.php |  1 +
 metadata-templates/shib13-sp-hosted.php  |  1 +
 metadata-templates/shib13-sp-remote.php  |  1 +
 metadata-templates/wsfed-idp-remote.php  |  1 +
 metadata-templates/wsfed-sp-hosted.php   |  1 +
 src/js/bundle.js                         | 12 +++----
 src/js/logout/logout.js                  | 37 ++++++++++++---------
 www/_include.php                         |  4 +--
 www/admin/metadata-converter.php         |  4 +--
 www/admin/sandbox.php                    |  5 ++-
 www/errorreport.php                      |  6 ++--
 www/module.php                           |  1 +
 www/saml2/idp/SSOService.php             |  2 +-
 www/saml2/idp/SingleLogoutService.php    |  2 +-
 www/saml2/idp/initSLO.php                |  2 +-
 www/saml2/idp/metadata.php               | 10 +++---
 26 files changed, 104 insertions(+), 83 deletions(-)

diff --git a/bin/importPdoMetadata.php b/bin/importPdoMetadata.php
index 4cba30d2c..225472cde 100755
--- a/bin/importPdoMetadata.php
+++ b/bin/importPdoMetadata.php
@@ -2,8 +2,8 @@
 <?php
 $baseDir = dirname(dirname(__FILE__));
 
-require_once $baseDir.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'_autoload.php';
-require_once \SimpleSAML\Utils\Config::getConfigDir().DIRECTORY_SEPARATOR.'config.php';
+require_once $baseDir.DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . '_autoload.php';
+require_once \SimpleSAML\Utils\Config::getConfigDir() . DIRECTORY_SEPARATOR . 'config.php';
 
 # Iterate through configured metadata sources and ensure
 # that a PDO source exists.
@@ -18,10 +18,10 @@ foreach ($config['metadata.sources'] as $s) {
             $metadata = [];
             require_once $filename;
             $set = basename($filename, ".php");
-            echo "importing set '$set'...".PHP_EOL;
+            echo "importing set '$set'..." . PHP_EOL;
 
             foreach ($metadata as $k => $v) {
-                echo "\t$k".PHP_EOL;
+                echo "\t$k" . PHP_EOL;
                 $mdshp->addEntry($k, $set, $v);
             }
         }
diff --git a/bin/initMDSPdo.php b/bin/initMDSPdo.php
index 403b4d2de..840585d4a 100755
--- a/bin/initMDSPdo.php
+++ b/bin/initMDSPdo.php
@@ -5,8 +5,8 @@
 $baseDir = dirname(dirname(__FILE__));
 
 // Add library autoloader and configuration
-require_once $baseDir.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'_autoload.php';
-require_once \SimpleSAML\Utils\Config::getConfigDir().DIRECTORY_SEPARATOR.'config.php';
+require_once $baseDir . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . '_autoload.php';
+require_once \SimpleSAML\Utils\Config::getConfigDir() . DIRECTORY_SEPARATOR . 'config.php';
 
 echo "Initializing Metadata Database...".PHP_EOL;
 
@@ -19,9 +19,9 @@ foreach ($config['metadata.sources'] as $source) {
         $result = $metadataStorageHandler->initDatabase();
 
         if ($result === false) {
-            echo "Failed to initialize metadata database.".PHP_EOL;
+            echo "Failed to initialize metadata database." . PHP_EOL;
         } else {
-            echo "Successfully initialized metadata database.".PHP_EOL;
+            echo "Successfully initialized metadata database." . PHP_EOL;
         }
     }
 }
diff --git a/bin/memcacheSync.php b/bin/memcacheSync.php
index 0dfdc31f4..f58c83e2f 100755
--- a/bin/memcacheSync.php
+++ b/bin/memcacheSync.php
@@ -1,7 +1,6 @@
 #!/usr/bin/env php
 <?php
 
-
 // Check that the memcache library is enabled
 if (!class_exists('Memcache') && !class_exists('Memcached')) {
     echo "Error: the memcached (or memcache) PHP extension appears to be unavailable.\n";
@@ -39,21 +38,21 @@ $keys = [];
 foreach ($stats as $group) {
     foreach ($group as $server => $state) {
         if ($state === false) {
-            echo "WARNING: Server ".$server." is down.\n";
+            echo "WARNING: Server " . $server . " is down.\n";
             $warnServerDown++;
             continue;
         }
 
         $items = $state['curr_items'];
-        echo "Server ".$server." has ".$items." items.\n";
+        echo "Server " . $server . " has " . $items . " items.\n";
         $serverKeys = getServerKeys($server);
         $keys = array_merge($keys, $serverKeys);
     }
 }
 
-echo "Total number of keys: ".count($keys)."\n";
+echo "Total number of keys: " . count($keys) . "\n";
 $keys = array_unique($keys);
-echo "Total number of unique keys: ".count($keys)."\n";
+echo "Total number of unique keys: ".count($keys) . "\n";
 
 echo "Starting synchronization.\n" ;
 
@@ -70,19 +69,19 @@ foreach ($keys as $key) {
 
 
 echo "Synchronization done.\n";
-echo $sync." keys in sync.\n";
+echo $sync . " keys in sync.\n";
 if ($skipped > 0) {
-    echo $skipped." keys skipped.\n";
+    echo $skipped . " keys skipped.\n";
     echo "Keys are skipped because they are either expired, or are of a type unknown\n";
     echo "to SimpleSAMLphp.\n";
 }
 
 if ($warnServerDown > 0) {
-    echo "WARNING: ".$warnServerDown." server(s) down. Not all servers are synchronized.\n";
+    echo "WARNING: " . $warnServerDown . " server(s) down. Not all servers are synchronized.\n";
 }
 
 if ($warnBigSlab > 0) {
-    echo "WARNING: ".$warnBigSlab." slab(s) may have contained more keys than we were told about.\n";
+    echo "WARNING: " . $warnBigSlab . " slab(s) may have contained more keys than we were told about.\n";
 }
 
 /**
@@ -98,7 +97,7 @@ function getServerKeys($server)
     $host = $server[0];
     $port = (int) $server[1];
 
-    echo "Connecting to: ".$host.":".$port."\n";
+    echo "Connecting to: " . $host . ":" . $port . "\n";
     $socket = fsockopen($host, $port);
     echo "Connected. Finding keys.\n";
 
@@ -126,7 +125,7 @@ function getServerKeys($server)
     // Dump keys in slabs
     $keys = [];
     foreach ($slabs as $slab) {
-        if (fwrite($socket, "stats cachedump ".$slab." 1000000\r\n") === false) {
+        if (fwrite($socket, "stats cachedump " . $slab . " 1000000\r\n") === false) {
             echo "Error requesting cache dump from server.\n";
             exit(1);
         }
@@ -147,17 +146,17 @@ function getServerKeys($server)
             if (preg_match('/^ITEM (.*) \[\d+ b; \d+ s\]/', $line, $matches)) {
                 $keys[] = $matches[1];
             } else {
-                echo "Unknown result from cache dump: ".$line."\n";
+                echo "Unknown result from cache dump: " . $line . "\n";
             }
         }
         if ($resultSize > 1900000 || count($keys) >= 1000000) {
-            echo "WARNING: Slab ".$slab." on server ".$host.":".$port.
+            echo "WARNING: Slab ".$slab." on server " . $host . ":" . $port .
                 " may have contained more keys than we were told about.\n";
             $GLOBALS['warnBigSlab'] += 1;
         }
     }
 
-    echo "Found ".count($keys)." key(s).\n";
+    echo "Found " . count($keys) . " key(s).\n";
     fclose($socket);
 
     return $keys;
diff --git a/bin/pwgen.php b/bin/pwgen.php
index b9789cb57..7ef18b3e5 100755
--- a/bin/pwgen.php
+++ b/bin/pwgen.php
@@ -1,16 +1,16 @@
 #!/usr/bin/env php
 <?php
+
 /*
  * Interactive script to generate password hashes.
  *
  */
 
-
 // This is the base directory of the SimpleSAMLphp installation
 $baseDir = dirname(dirname(__FILE__));
 
 // Add library autoloader
-require_once($baseDir.'/lib/_autoload.php');
+require_once($baseDir . '/lib/_autoload.php');
 
 
 echo "Enter password: ";
@@ -21,4 +21,4 @@ if (empty($password)) {
     exit(1);
 }
 
-echo "\n  ".SimpleSAML\Utils\Crypto::pwHash($password)."\n\n";
+echo "\n  " . SimpleSAML\Utils\Crypto::pwHash($password) . "\n\n";
diff --git a/bin/translateAttributes.php b/bin/translateAttributes.php
index 73beff84d..07cf01218 100755
--- a/bin/translateAttributes.php
+++ b/bin/translateAttributes.php
@@ -6,17 +6,17 @@
  * translation file for each supported language.
  */
 
-$base = __DIR__.'/../';
+$base = __DIR__ . '/../';
 
-include_once($base.'vendor/autoload.php');
+include_once($base . 'vendor/autoload.php');
 
-include_once($base.'attributemap/name2urn.php');
+include_once($base . 'attributemap/name2urn.php');
 $names = $attributemap;
 
-include_once($base.'attributemap/urn2oid.php');
+include_once($base . 'attributemap/urn2oid.php');
 $urns = $attributemap;
 
-include_once($base.'attributemap/newSchacNS.php');
+include_once($base . 'attributemap/newSchacNS.php');
 $schac = $attributemap;
 
 /*
@@ -25,8 +25,8 @@ $schac = $attributemap;
  * probably consider moving the "dictionaries/attributes.definition.json" file somewhere else, and keep using it as
  * the authoritative source of known attributes for this script.
  */
-$defs = json_decode(file_get_contents($base.'dictionaries/attributes.definition.json'), true);
-$trans = json_decode(file_get_contents($base.'dictionaries/attributes.translation.json'), true);
+$defs = json_decode(file_get_contents($base . 'dictionaries/attributes.definition.json'), true);
+$trans = json_decode(file_get_contents($base . 'dictionaries/attributes.translation.json'), true);
 
 $attributes = [];
 
@@ -38,16 +38,16 @@ unset($languages['no']);
 // build the list of attributes with their corresponding aliases
 foreach ($names as $name => $urn) {
     $lower = str_replace([':', '-'], '_', strtolower($name));
-    if (!array_key_exists('attribute_'.$lower, $defs)) {
+    if (!array_key_exists('attribute_' . $lower, $defs)) {
         $defs['attribute_'.$lower] = [];
     }
-    if (!array_key_exists('attribute_'.$lower, $trans)) {
+    if (!array_key_exists('attribute_' . $lower, $trans)) {
         $trans['attribute_'.$lower] = [];
     }
-    if (array_key_exists('no', $trans['attribute_'.$lower])) {
+    if (array_key_exists('no', $trans['attribute_' . $lower])) {
         // fix the locale code
-        $trans['attribute_'.$lower]['nb'] = $trans['attribute_'.$lower]['no'];
-        unset($trans['attribute_'.$lower]['no']);
+        $trans['attribute_' . $lower]['nb'] = $trans['attribute_' . $lower]['no'];
+        unset($trans['attribute_' . $lower]['no']);
     }
     $names = [$name, $urn, $urns[$urn]];
     if (array_key_exists($urn, $schac)) {
@@ -57,16 +57,16 @@ foreach ($names as $name => $urn) {
         'names' => $names,
         'translations' => array_merge(
             [
-                'en' => $defs['attribute_'.$lower]['en'],
+                'en' => $defs['attribute_' . $lower]['en'],
             ],
-            $trans['attribute_'.$lower]
+            $trans['attribute_' . $lower]
         ),
     ];
 }
 
 // process other sets of attributes
 foreach (['facebook', 'linkedin', 'openid', 'twitter', 'windowslive'] as $set) {
-    include_once($base.'attributemap/'.$set.'2name.php');
+    include_once($base . 'attributemap/' . $set . '2name.php');
     foreach ($attributemap as $alias => $attr) {
         if (array_key_exists($attr, $attributes)) {
             $attributes[$attr]['names'][] = $alias;
@@ -79,7 +79,7 @@ foreach (array_keys($languages) as $language) {
     $strings = new Gettext\Translations();
 
     // load existing translations in the PO files
-    $strings->addFromPoFile($base.'locales/'.$language."/LC_MESSAGES/attributes.po");
+    $strings->addFromPoFile($base . 'locales/' . $language . "/LC_MESSAGES/attributes.po");
 
     foreach ($attributes as $attribute) {
         foreach ($attribute['names'] as $name) {
@@ -88,7 +88,8 @@ foreach (array_keys($languages) as $language) {
             }
             $translation = new Gettext\Translation('', $name);
             if (array_key_exists($language, $attribute['translations']) &&
-                !is_null($attribute['translations'][$language])) {
+                !is_null($attribute['translations'][$language])
+            ) {
                 $t = $strings->find($translation);
                 if ($t) {
                     if ($t->getOriginal() === $t->getTranslation()) {
@@ -98,7 +99,7 @@ foreach (array_keys($languages) as $language) {
                 }
             }
             if (!is_null($attribute['translations']['en']) && $language !== 'en') {
-                $translation->addComment('English string: '.$attribute['translations']['en']);
+                $translation->addComment('English string: ' . $attribute['translations']['en']);
             }
             $strings[] = $translation;
         }
@@ -116,6 +117,6 @@ foreach (array_keys($languages) as $language) {
     $strings->deleteHeader('PO-Revision-Date');
 
     $strings->setLanguage($language);
-    echo "Saving translations to ".$base."locales/".$language."/LC_MESSAGES/attributes.po\n";
-    Gettext\Generators\Po::toFile($strings, $base.'locales/'.$language.'/LC_MESSAGES/attributes.po');
+    echo "Saving translations to " . $base . "locales/" . $language . "/LC_MESSAGES/attributes.po\n";
+    Gettext\Generators\Po::toFile($strings, $base . 'locales/' . $language . '/LC_MESSAGES/attributes.po');
 }
diff --git a/config-templates/authsources.php b/config-templates/authsources.php
index b63ac6083..f2d562163 100644
--- a/config-templates/authsources.php
+++ b/config-templates/authsources.php
@@ -57,7 +57,8 @@ $config = [
         'dsn' => 'pgsql:host=sql.example.org;port=5432;dbname=simplesaml',
         'username' => 'simplesaml',
         'password' => 'secretpassword',
-        'query' => 'SELECT uid, givenName, email, eduPersonPrincipalName FROM users WHERE uid = :username AND password = SHA2(CONCAT((SELECT salt FROM users WHERE uid = :username), :password), 256);',
+        'query' => 'SELECT uid, givenName, email, eduPersonPrincipalName FROM users WHERE uid = :username ' .
+            'AND password = SHA2(CONCAT((SELECT salt FROM users WHERE uid = :username), :password), 256);',
     ],
     */
 
diff --git a/metadata-templates/saml20-idp-hosted.php b/metadata-templates/saml20-idp-hosted.php
index ecb05ce11..79dc926d6 100644
--- a/metadata-templates/saml20-idp-hosted.php
+++ b/metadata-templates/saml20-idp-hosted.php
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * SAML 2.0 IdP configuration for SimpleSAMLphp.
  *
diff --git a/metadata-templates/saml20-idp-remote.php b/metadata-templates/saml20-idp-remote.php
index d390647e6..264e8bcdb 100644
--- a/metadata-templates/saml20-idp-remote.php
+++ b/metadata-templates/saml20-idp-remote.php
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * SAML 2.0 remote IdP metadata for SimpleSAMLphp.
  *
diff --git a/metadata-templates/saml20-sp-remote.php b/metadata-templates/saml20-sp-remote.php
index a9940e820..0b0315ce0 100644
--- a/metadata-templates/saml20-sp-remote.php
+++ b/metadata-templates/saml20-sp-remote.php
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * SAML 2.0 remote SP metadata for SimpleSAMLphp.
  *
diff --git a/metadata-templates/shib13-idp-hosted.php b/metadata-templates/shib13-idp-hosted.php
index 28ccc42b3..dc6c9e0a9 100644
--- a/metadata-templates/shib13-idp-hosted.php
+++ b/metadata-templates/shib13-idp-hosted.php
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * SAML 1.1 IdP configuration for SimpleSAMLphp.
  *
diff --git a/metadata-templates/shib13-idp-remote.php b/metadata-templates/shib13-idp-remote.php
index 69c1ef324..9aa6f0e64 100644
--- a/metadata-templates/shib13-idp-remote.php
+++ b/metadata-templates/shib13-idp-remote.php
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * SAML 1.1 remote IdP metadata for SimpleSAMLphp.
  *
diff --git a/metadata-templates/shib13-sp-hosted.php b/metadata-templates/shib13-sp-hosted.php
index e3581c9b8..15a275a38 100644
--- a/metadata-templates/shib13-sp-hosted.php
+++ b/metadata-templates/shib13-sp-hosted.php
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * SAML 1.1 SP configuration for SimpleSAMLphp.
  *
diff --git a/metadata-templates/shib13-sp-remote.php b/metadata-templates/shib13-sp-remote.php
index f60174e28..b2fb1d8e0 100644
--- a/metadata-templates/shib13-sp-remote.php
+++ b/metadata-templates/shib13-sp-remote.php
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * SAML 1.1 remote SP metadata for SimpleSAMLphp.
  *
diff --git a/metadata-templates/wsfed-idp-remote.php b/metadata-templates/wsfed-idp-remote.php
index 214679ce3..05732c664 100644
--- a/metadata-templates/wsfed-idp-remote.php
+++ b/metadata-templates/wsfed-idp-remote.php
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * WS-Federation remote IdP metadata for SimpleSAMLphp.
  */
diff --git a/metadata-templates/wsfed-sp-hosted.php b/metadata-templates/wsfed-sp-hosted.php
index 5ebdf21c1..bb123b941 100644
--- a/metadata-templates/wsfed-sp-hosted.php
+++ b/metadata-templates/wsfed-sp-hosted.php
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * WS-Federation SP configuration for SimpleSAMLphp.
  *
diff --git a/src/js/bundle.js b/src/js/bundle.js
index a485174ba..14e550b24 100644
--- a/src/js/bundle.js
+++ b/src/js/bundle.js
@@ -9,7 +9,7 @@ import json from "highlight.js/lib/languages/json";
 $(document).ready(function () {
     // get available languages
     let languages = $.map($('#language-selector option'), function (option) {
-       return option.text.toLowerCase();
+        return option.text.toLowerCase();
     });
 
     // initialize selectize
@@ -30,7 +30,7 @@ $(document).ready(function () {
     });
 
     // expander boxes
-    $('.expandable > .expander').on('click', function(e) {
+    $('.expandable > .expander').on('click', function (e) {
         e.preventDefault();
         let target = $(e.currentTarget);
         target.parents('.expandable').toggleClass('expanded');
@@ -41,15 +41,15 @@ $(document).ready(function () {
     hljs.registerLanguage('xml', xml);
     hljs.registerLanguage('php', php);
     hljs.registerLanguage('json', json);
-    $('.code-box-content.xml, .code-box-content.php, .code-box-content.json').each(function(i, block) {
+    $('.code-box-content.xml, .code-box-content.php, .code-box-content.json').each(function (i, block) {
         hljs.highlightBlock(block)
     });
 
     // clipboard
     let clipboard = new ClipboardJS('.copy');
-    clipboard.on('success', function(e) {
-        setTimeout(function() {
+    clipboard.on('success', function (e) {
+        setTimeout(function () {
             e.clearSelection();
         }, 150);
     });
-});
\ No newline at end of file
+});
diff --git a/src/js/logout/logout.js b/src/js/logout/logout.js
index aec766b8f..a1b543486 100644
--- a/src/js/logout/logout.js
+++ b/src/js/logout/logout.js
@@ -12,7 +12,8 @@
  * error or not, and call the appropriate method (either completed() or failed()).
  */
 class SimpleSAMLLogout {
-    constructor(page) {
+    constructor(page)
+    {
         if (page === 'core:logout-iframe') { // main page
             this.populateData();
             if (Object.keys(this.sps).length === 0) {
@@ -21,7 +22,6 @@ class SimpleSAMLLogout {
             }
             this.btnall.on('click', this.initLogout.bind(this));
             window.addEventListener('message', this.clearAssociation.bind(this), false);
-
         } else if (page === 'IFrameLogoutHandler') { // iframe
             let data = $('i[id="data"]');
             let message = {
@@ -41,7 +41,8 @@ class SimpleSAMLLogout {
      *
      * @param event The event containing the message from the iframe.
      */
-    clearAssociation(event) {
+    clearAssociation(event)
+    {
         if (event.origin !== SimpleSAMLLogout.getOrigin()) {
             // we don't accept events from other origins
             return;
@@ -69,7 +70,8 @@ class SimpleSAMLLogout {
      *
      * @param id The ID of the SP that completed logout successfully.
      */
-    completed(id) {
+    completed(id)
+    {
         if (typeof this.sps[id] === 'undefined') {
             return;
         }
@@ -91,7 +93,8 @@ class SimpleSAMLLogout {
      * @param id The ID of the SP that failed to complete logout.
      * @param reason The reason why logout failed.
      */
-    failed(id, reason) {
+    failed(id, reason)
+    {
         if (typeof this.sps[id] === 'undefined') {
             return;
         }
@@ -121,7 +124,8 @@ class SimpleSAMLLogout {
      *
      * Note: this method won't do anything if there are SPs pending logout (e.g. waiting for the timeout).
      */
-    finish() {
+    finish()
+    {
         if (Object.keys(this.sps).length > 0) { // pending services
             return;
         }
@@ -134,7 +138,6 @@ class SimpleSAMLLogout {
             this.errmsg.removeClass('hidden');
             this.errfrm.removeClass('hidden');
             this.actions.addClass('hidden');
-
         } else { // all services done
             this.btncontinue.click();
         }
@@ -144,12 +147,13 @@ class SimpleSAMLLogout {
     /**
      * Get the origin of the current page.
      */
-    static getOrigin() {
+    static getOrigin()
+    {
         let origin = window.location.origin;
         if (!origin) {
             // IE < 11 does not support window.location.origin
             origin = window.location.protocol + "//" + window.location.hostname +
-                (window.location.port ? ':' + window.location.port: '');
+                (window.location.port ? ':' + window.location.port : '');
         }
         return origin;
     }
@@ -160,7 +164,8 @@ class SimpleSAMLLogout {
      *
      * @param event The click event on the "Yes, all services" button.
      */
-    initLogout(event) {
+    initLogout(event)
+    {
         event.preventDefault();
 
         this.btnall.prop('disabled', true);
@@ -180,7 +185,8 @@ class SimpleSAMLLogout {
      *
      * If an SP didn't reply by the timeout, we'll mark it as failed.
      */
-    initTimeout() {
+    initTimeout()
+    {
         let timeout = 10;
 
         for (const id in this.sps) {
@@ -217,7 +223,8 @@ class SimpleSAMLLogout {
     /**
      * This method populates the data we need from data-* properties in the page.
      */
-    populateData() {
+    populateData()
+    {
         this.sps = {};
         this.btnall = $('button[id="btn-all"]');
         this.btncancel = $('button[id="btn-cancel"]');
@@ -231,7 +238,7 @@ class SimpleSAMLLogout {
         // initialise SP status and timeout arrays
         $('li[id^="sp-"]').each(function () {
             let id = $(this).data('id');
-            let iframe = $('iframe[id="iframe-'+id+'"]');
+            let iframe = $('iframe[id="iframe-' + id + '"]');
             let status = $(this).data('status');
 
             switch (status) {
@@ -246,10 +253,10 @@ class SimpleSAMLLogout {
                 timeout: $(this).data('timeout'),
                 element: $(this),
                 iframe: iframe,
-                icon: $('i[id="icon-'+id+'"]'),
+                icon: $('i[id="icon-' + id + '"]'),
             };
         });
     }
 }
 
-export default SimpleSAMLLogout;
\ No newline at end of file
+export default SimpleSAMLLogout;
diff --git a/www/_include.php b/www/_include.php
index 1960627f8..afe9b6b39 100644
--- a/www/_include.php
+++ b/www/_include.php
@@ -1,7 +1,7 @@
 <?php
 
 // initialize the autoloader
-require_once(dirname(dirname(__FILE__)).'/lib/_autoload.php');
+require_once(dirname(dirname(__FILE__)) . '/lib/_autoload.php');
 
 // enable assertion handler for all pages
 \SimpleSAML\Error\Assertion::installHandler();
@@ -45,7 +45,7 @@ function SimpleSAML_error_handler($errno, $errstr, $errfile = null, $errline = 0
 
     // show an error with a full backtrace
     $context = (is_null($errfile) ? '' : " at $errfile:$errline");
-    $e = new \SimpleSAML\Error\Exception('Error '.$errno.' - '.$errstr.$context);
+    $e = new \SimpleSAML\Error\Exception('Error ' . $errno . ' - ' . $errstr . $context);
     $e->logError();
 
     // resume normal error processing
diff --git a/www/admin/metadata-converter.php b/www/admin/metadata-converter.php
index 5ce928ac5..83837409d 100644
--- a/www/admin/metadata-converter.php
+++ b/www/admin/metadata-converter.php
@@ -41,8 +41,8 @@ if (!empty($xmldata)) {
             // remove the entityDescriptor element because it is unused, and only makes the output harder to read
             unset($entityMetadata['entityDescriptor']);
 
-            $text .= '$metadata['.var_export($entityId, true).'] = '.
-                var_export($entityMetadata, true).";\n";
+            $text .= '$metadata[' . var_export($entityId, true) . '] = ' .
+                var_export($entityMetadata, true) . ";\n";
         }
         $entities = $text;
     }
diff --git a/www/admin/sandbox.php b/www/admin/sandbox.php
index e2318bd18..820c1fc2c 100644
--- a/www/admin/sandbox.php
+++ b/www/admin/sandbox.php
@@ -10,7 +10,10 @@ $session = \SimpleSAML\Session::getSessionFromRequest();
 
 $template = new \SimpleSAML\XHTML\Template($config, 'sandbox.php');
 $template->data['pagetitle'] = 'Sandbox';
-$template->data['sometext'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur.';
+$template->data['sometext'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus.' .
+    ' Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit.' .
+    ' Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. ' .
+    'Nam tincidunt congue enim, ut porta lorem lacinia consectetur.';
 $template->data['remaining'] = $session->getAuthData('admin', 'Expire') - time();
 $template->data['logout'] = null;
 
diff --git a/www/errorreport.php b/www/errorreport.php
index cd4be1d79..1c8071305 100644
--- a/www/errorreport.php
+++ b/www/errorreport.php
@@ -22,7 +22,7 @@ try {
     $session = \SimpleSAML\Session::getSessionFromRequest();
     $data = $session->getData('core:errorreport', $reportId);
 } catch (\Exception $e) {
-    \SimpleSAML\Logger::error('Error loading error report data: '.var_export($e->getMessage(), true));
+    \SimpleSAML\Logger::error('Error loading error report data: ' . var_export($e->getMessage(), true));
 }
 
 if ($data === null) {
@@ -45,12 +45,12 @@ $data['hostname'] = php_uname('n');
 $data['directory'] = dirname(dirname(__FILE__));
 
 if ($config->getBoolean('errorreporting', true)) {
-    $mail = new SimpleSAML\Utils\EMail('SimpleSAMLphp error report from '.$email);
+    $mail = new SimpleSAML\Utils\EMail('SimpleSAMLphp error report from ' . $email);
     $mail->setData($data);
     $mail->addReplyTo($email);
     $mail->setText($text);
     $mail->send();
-    SimpleSAML\Logger::error('Report with id '.$reportId.' sent');
+    SimpleSAML\Logger::error('Report with id ' . $reportId . ' sent');
 }
 
 // redirect the user back to this page to clear the POST request
diff --git a/www/module.php b/www/module.php
index 83ee0ff38..ebdc6b19c 100644
--- a/www/module.php
+++ b/www/module.php
@@ -4,6 +4,7 @@
  * This web page receives requests for web-pages hosted by modules, and directs them to
  * the process() handler in the Module class.
  */
+
 require_once('_include.php');
 
 \SimpleSAML\Module::process()->send();
diff --git a/www/saml2/idp/SSOService.php b/www/saml2/idp/SSOService.php
index c3e491684..5a400b854 100644
--- a/www/saml2/idp/SSOService.php
+++ b/www/saml2/idp/SSOService.php
@@ -15,7 +15,7 @@ require_once('../../_include.php');
 
 $metadata = \SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler();
 $idpEntityId = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted');
-$idp = \SimpleSAML\IdP::getById('saml2:'.$idpEntityId);
+$idp = \SimpleSAML\IdP::getById('saml2:' . $idpEntityId);
 
 try {
     \SimpleSAML\Module\saml\IdP\SAML2::receiveAuthnRequest($idp);
diff --git a/www/saml2/idp/SingleLogoutService.php b/www/saml2/idp/SingleLogoutService.php
index 6e6e9a5f8..2d3c0e4b4 100644
--- a/www/saml2/idp/SingleLogoutService.php
+++ b/www/saml2/idp/SingleLogoutService.php
@@ -14,7 +14,7 @@ require_once('../../_include.php');
 
 $metadata = \SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler();
 $idpEntityId = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted');
-$idp = \SimpleSAML\IdP::getById('saml2:'.$idpEntityId);
+$idp = \SimpleSAML\IdP::getById('saml2:' . $idpEntityId);
 
 if (isset($_REQUEST['ReturnTo'])) {
     $idp->doLogoutRedirect(\SimpleSAML\Utils\HTTP::checkURLAllowed((string) $_REQUEST['ReturnTo']));
diff --git a/www/saml2/idp/initSLO.php b/www/saml2/idp/initSLO.php
index 21576797d..82c38c8d4 100644
--- a/www/saml2/idp/initSLO.php
+++ b/www/saml2/idp/initSLO.php
@@ -4,7 +4,7 @@ require_once('../../_include.php');
 
 $metadata = \SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler();
 $idpEntityId = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted');
-$idp = \SimpleSAML\IdP::getById('saml2:'.$idpEntityId);
+$idp = \SimpleSAML\IdP::getById('saml2:' . $idpEntityId);
 
 \SimpleSAML\Logger::info('SAML2.0 - IdP.initSLO: Accessing SAML 2.0 IdP endpoint init Single Logout');
 
diff --git a/www/saml2/idp/metadata.php b/www/saml2/idp/metadata.php
index 091f8e4d7..fe741a1d3 100644
--- a/www/saml2/idp/metadata.php
+++ b/www/saml2/idp/metadata.php
@@ -112,7 +112,7 @@ try {
         // Artifact sending enabled
         $metaArray['ArtifactResolutionService'][] = [
             'index'    => 0,
-            'Location' => HTTP::getBaseURL().'saml2/idp/ArtifactResolutionService.php',
+            'Location' => HTTP::getBaseURL() . 'saml2/idp/ArtifactResolutionService.php',
             'Binding'  => Constants::BINDING_SOAP,
         ];
     }
@@ -122,7 +122,7 @@ try {
         array_unshift($metaArray['SingleSignOnService'], [
             'hoksso:ProtocolBinding' => Constants::BINDING_HTTP_REDIRECT,
             'Binding'                => Constants::BINDING_HOK_SSO,
-            'Location'               => HTTP::getBaseURL().'saml2/idp/SSOService.php'
+            'Location'               => HTTP::getBaseURL() . 'saml2/idp/SSOService.php'
         ]);
     }
 
@@ -130,7 +130,7 @@ try {
         $metaArray['SingleSignOnService'][] = [
             'index' => 0,
             'Binding'  => Constants::BINDING_SOAP,
-            'Location' => HTTP::getBaseURL().'saml2/idp/SSOService.php',
+            'Location' => HTTP::getBaseURL() . 'saml2/idp/SSOService.php',
         ];
     }
 
@@ -206,7 +206,7 @@ try {
 
     $metaxml = $metaBuilder->getEntityDescriptorText();
 
-    $metaflat = '$metadata['.var_export($idpentityid, true).'] = '.var_export($metaArray, true).';';
+    $metaflat = '$metadata[' . var_export($idpentityid, true) . '] = ' . var_export($metaArray, true) . ';';
 
     // sign the metadata if enabled
     $metaxml = \SimpleSAML\Metadata\Signer::sign($metaxml, $idpmeta->toArray(), 'SAML 2 IdP');
@@ -219,7 +219,7 @@ try {
         $certdata = [];
         foreach (array_keys($availableCerts) as $availableCert) {
             $certdata[$availableCert]['name'] = $availableCert;
-            $certdata[$availableCert]['url'] = SimpleSAML\Module::getModuleURL('saml/idp/certs.php').'/'.$availableCert;
+            $certdata[$availableCert]['url'] = SimpleSAML\Module::getModuleURL('saml/idp/certs.php') . '/' . $availableCert;
             $certdata[$availableCert]['comment'] = (
                 $availableCerts[$availableCert]['certFingerprint'][0] === 'afe71c28ef740bc87425be13a2263d37971da1f9' ?
                 'This is the default certificate. Generate a new certificate if this is a production system.' :
-- 
GitLab