diff --git a/modules/adfs/www/idp/metadata.php b/modules/adfs/www/idp/metadata.php
index 8308373f342c67ccc9367277d839ba7fe6152efa..0bfd0a9327fcfd96a88012b11ebe525c7897dd10 100644
--- a/modules/adfs/www/idp/metadata.php
+++ b/modules/adfs/www/idp/metadata.php
@@ -10,19 +10,18 @@ if (!$config->getBoolean('enable.adfs-idp', false)) {
 
 // check if valid local session exists
 if ($config->getBoolean('admin.protectmetadata', false)) {
-    SimpleSAML\Utils\Auth::requireAdmin();
+    \SimpleSAML\Utils\Auth::requireAdmin();
 }
 
 try {
     $idpentityid = isset($_GET['idpentityid']) ?
-        $_GET['idpentityid'] :
-        $metadata->getMetaDataCurrentEntityID('adfs-idp-hosted');
+        $_GET['idpentityid'] : $metadata->getMetaDataCurrentEntityID('adfs-idp-hosted');
     $idpmeta = $metadata->getMetaDataConfig($idpentityid, 'adfs-idp-hosted');
 
     $availableCerts = array();
 
     $keys = array();
-    $certInfo = SimpleSAML\Utils\Crypto::loadPublicKey($idpmeta, false, 'new_');
+    $certInfo = \SimpleSAML\Utils\Crypto::loadPublicKey($idpmeta, false, 'new_');
     if ($certInfo !== null) {
         $availableCerts['new_idp.crt'] = $certInfo;
         $keys[] = array(
@@ -36,7 +35,7 @@ try {
         $hasNewCert = false;
     }
 
-    $certInfo = SimpleSAML\Utils\Crypto::loadPublicKey($idpmeta, true);
+    $certInfo = \SimpleSAML\Utils\Crypto::loadPublicKey($idpmeta, true);
     $availableCerts['idp.crt'] = $certInfo;
     $keys[] = array(
         'type'            => 'X509Certificate',
@@ -46,7 +45,7 @@ try {
     );
 
     if ($idpmeta->hasValue('https.certificate')) {
-        $httpsCert = SimpleSAML\Utils\Crypto::loadPublicKey($idpmeta, true, 'https.');
+        $httpsCert = \SimpleSAML\Utils\Crypto::loadPublicKey($idpmeta, true, 'https.');
         assert(isset($httpsCert['certData']));
         $availableCerts['https.crt'] = $httpsCert;
         $keys[] = array(
@@ -57,7 +56,7 @@ try {
         );
     }
 
-    $adfs_service_location = SimpleSAML\Module::getModuleURL('adfs').'/idp/prp.php';
+    $adfs_service_location = \SimpleSAML\Module::getModuleURL('adfs').'/idp/prp.php';
     $metaArray = array(
         'metadata-set'        => 'adfs-idp-remote',
         'entityid'            => $idpentityid,
@@ -149,10 +148,10 @@ try {
         $t->data['clipboard.js'] = true;
         $t->data['available_certs'] = $availableCerts;
         $certdata = array();
-        foreach(array_keys($availableCerts) as $availableCert) {
-               $certdata[$availableCert]['name'] = $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.' : '');
+        foreach (array_keys($availableCerts) as $availableCert) {
+            $certdata[$availableCert]['name'] = $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.' : '');
         }
         $t->data['certdata'] = $certdata;
         $t->data['header'] = 'adfs-idp'; // TODO: Replace with headerString in 2.0
@@ -173,6 +172,6 @@ try {
 
         exit(0);
     }
-} catch (Exception $exception) {
+} catch (\Exception $exception) {
     throw new \SimpleSAML\Error\Error('METADATA', $exception);
 }
diff --git a/modules/authYubiKey/www/yubikeylogin.php b/modules/authYubiKey/www/yubikeylogin.php
index ae9ec786a1bc8ee91dcc418fa4d48e0b3af7e1f4..e3cc9264ec77115f85e18f4d2f20bd5aa5936f8d 100644
--- a/modules/authYubiKey/www/yubikeylogin.php
+++ b/modules/authYubiKey/www/yubikeylogin.php
@@ -10,7 +10,7 @@
  */
 
 if (!array_key_exists('AuthState', $_REQUEST)) {
-	throw new \SimpleSAML\Error\BadRequest('Missing AuthState parameter.');
+    throw new \SimpleSAML\Error\BadRequest('Missing AuthState parameter.');
 }
 
 $globalConfig = \SimpleSAML\Configuration::getInstance();
diff --git a/modules/consentAdmin/hooks/hook_frontpage.php b/modules/consentAdmin/hooks/hook_frontpage.php
index 9659a869f565e1f11b8cacd1743423c593255601..2567f2be69a41a1a16e8d81b4004c224f8b762ab 100644
--- a/modules/consentAdmin/hooks/hook_frontpage.php
+++ b/modules/consentAdmin/hooks/hook_frontpage.php
@@ -5,11 +5,11 @@
  * @param array &$links  The links on the frontpage, split into sections.
  */
 function consentAdmin_hook_frontpage(&$links) {
-	assert(is_array($links));
-	assert(array_key_exists('links', $links));
+    assert(is_array($links));
+    assert(array_key_exists('links', $links));
 
-	$links['config'][] = array(
-		'href' => SimpleSAML\Module::getModuleURL('consentAdmin/consentAdmin.php'),
-		'text' => '{core:frontpage:link_consentAdmin}',
-	);
+    $links['config'][] = array(
+        'href' => SimpleSAML\Module::getModuleURL('consentAdmin/consentAdmin.php'),
+        'text' => '{core:frontpage:link_consentAdmin}',
+    );
 }
diff --git a/modules/core/www/login.php b/modules/core/www/login.php
index d4babee68df32100470f5756103adc9f2d9beb1e..342787873046d143778606ee7272e6950cf29507 100644
--- a/modules/core/www/login.php
+++ b/modules/core/www/login.php
@@ -9,7 +9,7 @@ if (isset($sources['admin'])) {
 }
 
 //if only 1 auth
-if (count($sources)==1) {
+if (count($sources) == 1) {
     $_REQUEST['as'] = key($sources);
 }
 
@@ -58,6 +58,6 @@ $t->data['header'] = '{status:header_saml20_sp}';
 $t->data['attributes'] = $attributes;
 $t->data['nameid'] = !is_null($as->getAuthData('saml:sp:NameID')) ? $as->getAuthData('saml:sp:NameID') : false;
 $t->data['logouturl'] = \SimpleSAML\Utils\HTTP::getSelfURLNoQuery().'?as='.urlencode($asId).'&logout';
-$t->data['remaining'] = $session->getAuthData($asId, 'Expire')-time();
+$t->data['remaining'] = $session->getAuthData($asId, 'Expire') - time();
 
 $t->show();
diff --git a/modules/cron/hooks/hook_frontpage.php b/modules/cron/hooks/hook_frontpage.php
index 340b01636df85feda476c725bd003b04f56d48a0..b0e6696349429011d289fdff1db40449c3683aa1 100644
--- a/modules/cron/hooks/hook_frontpage.php
+++ b/modules/cron/hooks/hook_frontpage.php
@@ -5,12 +5,11 @@
  * @param array &$links  The links on the frontpage, split into sections.
  */
 function cron_hook_frontpage(&$links) {
-	assert(is_array($links));
-	assert(array_key_exists('links', $links));
-
-	$links['config'][] = array(
-		'href' => SimpleSAML\Module::getModuleURL('cron/croninfo.php'),
-		'text' => '{core:frontpage:link_cron}',
-	);
+    assert(is_array($links));
+    assert(array_key_exists('links', $links));
 
+    $links['config'][] = array(
+        'href' => SimpleSAML\Module::getModuleURL('cron/croninfo.php'),
+        'text' => '{core:frontpage:link_cron}',
+    );
 }
diff --git a/modules/discopower/lib/PowerIdPDisco.php b/modules/discopower/lib/PowerIdPDisco.php
index cbfa86270920e45f91cc51eac672ea027e5b64b9..e44d7c24454100345387ab52b091544b5d149992 100644
--- a/modules/discopower/lib/PowerIdPDisco.php
+++ b/modules/discopower/lib/PowerIdPDisco.php
@@ -286,11 +286,11 @@ class PowerIdPDisco extends \SimpleSAML\XHTML\IdPDisco
 
         $search = '<script type="text/javascript">
             $(document).ready(function() {
-                $("#tabdiv").tabs({ selected: ' . $t->data['defaulttab'] . ' });';
+                $("#tabdiv").tabs({ selected: '.$t->data['defaulttab'].' });';
         $i = 0;
         foreach ($idpList as $tab => $slist) {
-            $search .= "\n" . '$("#query_' . $tab . '").liveUpdate("#list_' . $tab . '")' .
-		(($i++ == 0) && (empty($this->data['faventry'])) ? '.focus()' : '') . ';';
+            $search .= "\n".'$("#query_'.$tab.'").liveUpdate("#list_'.$tab.'")' .
+            (($i++ == 0) && (empty($this->data['faventry'])) ? '.focus()' : '').';';
         }
         $search .= "});\n</script>";
 
@@ -308,9 +308,9 @@ class PowerIdPDisco extends \SimpleSAML\XHTML\IdPDisco
     private function processMetadata($t, $metadata, $favourite)
     {
         $basequerystring = '?' . 
-		'entityID=' . urlencode($t->data['entityID']) . '&amp;' . 
-		'return=' . urlencode($t->data['return']) . '&amp;' . 
-		'returnIDParam=' . urlencode($t->data['returnIDParam']) . '&amp;idpentityid=';
+            'entityID='.urlencode($t->data['entityID']).'&amp;'.
+            'return='.urlencode($t->data['return']).'&amp;'.
+            'returnIDParam='.urlencode($t->data['returnIDParam']).'&amp;idpentityid=';
 
         foreach ($metadata as $tab => $idps) {
             foreach ($idps as $entityid => $entity) {
@@ -343,14 +343,14 @@ class PowerIdPDisco extends \SimpleSAML\XHTML\IdPDisco
 
                 // HTML output
                 if ($entity['entityid'] === $favourite) {
-                    $html = '<a class="metaentry favourite" href="' . $basequerystring . urlencode($entity['entityid']) . '">';
+                    $html = '<a class="metaentry favourite" href="'.$basequerystring.urlencode($entity['entityid']).'">';
                 } else {
-                    $html = '<a class="metaentry" href="' . $basequerystring . urlencode($entity['entityid']) . '">';
+                    $html = '<a class="metaentry" href="'.$basequerystring.urlencode($entity['entityid']).'">';
                 }
                 $html .= $entity['translated'];
                 if (array_key_exists('icon', $entity) && $entity['icon'] !== null) {
                     $iconUrl = \SimpleSAML\Utils\HTTP::resolveURL($entity['icon']);
-                    $html .= '<img alt="Icon for identity provider" class="entryicon" src="' . htmlspecialchars($iconUrl) . '" />';
+                    $html .= '<img alt="Icon for identity provider" class="entryicon" src="'.htmlspecialchars($iconUrl).'" />';
                 }
                 $html .= '</a>';
                 $entity['html'] = $html;
diff --git a/modules/expirycheck/templates/about2expire.php b/modules/expirycheck/templates/about2expire.php
index f8749fdf6203c1076a1ab1c9de70183358f02402..b3c538b2c843e0caeed35ae37369834c5d560c85 100644
--- a/modules/expirycheck/templates/about2expire.php
+++ b/modules/expirycheck/templates/about2expire.php
@@ -24,20 +24,19 @@ $this->includeAtTemplateBase('includes/header.php');
 
 <form style="display: inline; margin: 0px; padding: 0px" action="<?php echo htmlspecialchars($this->data['yesTarget']); ?>">
 
-	<?php
-		// Embed hidden fields...
-		foreach ($this->data['yesData'] as $name => $value) {
-			echo('<input type="hidden" name="' . htmlspecialchars($name) . '" value="' . htmlspecialchars($value) . '" />');
-		}
-	?>
-	<h3><?php echo $warning; ?></h3>
-	<p><?php echo $this->t('{expirycheck:expwarning:expiry_date_text}') . " " . $this->data['expireOnDate']; ?></p>
+    <?php
+        // Embed hidden fields...
+        foreach ($this->data['yesData'] as $name => $value) {
+            echo '<input type="hidden" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" />';
+        }
+    ?>
+    <h3><?php echo $warning; ?></h3>
+    <p><?php echo $this->t('{expirycheck:expwarning:expiry_date_text}')." ".$this->data['expireOnDate']; ?></p>
 
-	<input type="submit" name="yes" id="yesbutton" value="<?php echo htmlspecialchars($this->t('{expirycheck:expwarning:btn_continue}')) ?>" />
+    <input type="submit" name="yes" id="yesbutton" value="<?php echo htmlspecialchars($this->t('{expirycheck:expwarning:btn_continue}')) ?>" />
 
 </form>
 
-
 <?php
 
 $this->includeAtTemplateBase('includes/footer.php');
diff --git a/modules/memcacheMonitor/hooks/hook_frontpage.php b/modules/memcacheMonitor/hooks/hook_frontpage.php
index 526359b05bfcde960ea89f88832c5a38ad2e5508..10a5cead6dc22ab5ce737feb6e4dd8a57e97766d 100644
--- a/modules/memcacheMonitor/hooks/hook_frontpage.php
+++ b/modules/memcacheMonitor/hooks/hook_frontpage.php
@@ -5,12 +5,11 @@
  * @param array &$links  The links on the frontpage, split into sections.
  */
 function memcacheMonitor_hook_frontpage(&$links) {
-	assert(is_array($links));
-	assert(array_key_exists('links', $links));
+    assert(is_array($links));
+    assert(array_key_exists('links', $links));
 
-	$links['config'][] = array(
-		'href' => SimpleSAML\Module::getModuleURL('memcacheMonitor/memcachestat.php'),
-		'text' => '{core:frontpage:link_memcacheMonitor}',
-	);
-	
+    $links['config'][] = array(
+        'href' => SimpleSAML\Module::getModuleURL('memcacheMonitor/memcachestat.php'),
+        'text' => '{core:frontpage:link_memcacheMonitor}',
+    );
 }
diff --git a/www/saml2/idp/metadata.php b/www/saml2/idp/metadata.php
index d15262f5a8ce81cf318a80e1b0305ed0a778fb0a..097b45ae0b426d8eaa9bf4d3c6001f3bda5666a7 100644
--- a/www/saml2/idp/metadata.php
+++ b/www/saml2/idp/metadata.php
@@ -23,8 +23,7 @@ if ($config->getBoolean('admin.protectmetadata', false)) {
 
 try {
     $idpentityid = isset($_GET['idpentityid']) ?
-        $_GET['idpentityid'] :
-        $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted');
+        $_GET['idpentityid'] : $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted');
     $idpmeta = $metadata->getMetaDataConfig($idpentityid, 'saml20-idp-hosted');
 
     $availableCerts = array();
@@ -220,10 +219,10 @@ try {
         $t->data['clipboard.js'] = true;
         $t->data['available_certs'] = $availableCerts;
         $certdata = array();
-        foreach(array_keys($availableCerts) as $availableCert) {
-               $certdata[$availableCert]['name'] = $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.' : '');
+        foreach (array_keys($availableCerts) as $availableCert) {
+            $certdata[$availableCert]['name'] = $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.' : '');
         }
         $t->data['certdata'] = $certdata;
         $t->data['header'] = 'saml20-idp'; // TODO: Replace with headerString in 2.0
@@ -234,12 +233,11 @@ try {
         $t->data['defaultidp'] = $defaultidp;
         $t->show();
     } else {
-
         header('Content-Type: application/xml');
 
         echo $metaxml;
         exit(0);
     }
-} catch (Exception $exception) {
+} catch (\Exception $exception) {
     throw new \SimpleSAML\Error\Error('METADATA', $exception);
 }