From 416234bad15ba5db106c461f90ce1afecc62c8d6 Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Mon, 7 Oct 2019 23:15:49 +0200 Subject: [PATCH] PSR-12 --- bin/importPdoMetadata.php | 2 +- bin/initMDSPdo.php | 2 +- bin/memcacheSync.php | 6 +++--- bin/translateAttributes.php | 11 ++++++----- phpcs.xml | 1 + www/saml2/idp/metadata.php | 4 +++- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/bin/importPdoMetadata.php b/bin/importPdoMetadata.php index 225472cde..3dbd6cf8c 100755 --- a/bin/importPdoMetadata.php +++ b/bin/importPdoMetadata.php @@ -2,7 +2,7 @@ <?php $baseDir = dirname(dirname(__FILE__)); -require_once $baseDir.DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . '_autoload.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 diff --git a/bin/initMDSPdo.php b/bin/initMDSPdo.php index 840585d4a..ca6029200 100755 --- a/bin/initMDSPdo.php +++ b/bin/initMDSPdo.php @@ -8,7 +8,7 @@ $baseDir = dirname(dirname(__FILE__)); 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; +echo "Initializing Metadata Database..." . PHP_EOL; # Iterate through configured metadata sources and ensure # that a PDO source exists. diff --git a/bin/memcacheSync.php b/bin/memcacheSync.php index f58c83e2f..910841e1c 100755 --- a/bin/memcacheSync.php +++ b/bin/memcacheSync.php @@ -21,7 +21,7 @@ if (!class_exists('Memcache') && !class_exists('Memcached')) { $baseDir = dirname(dirname(__FILE__)); // Add library autoloader -require_once($baseDir.'/lib/_autoload.php'); +require_once($baseDir . '/lib/_autoload.php'); // Initialize the configuration $configdir = SimpleSAML\Utils\Config::getConfigDir(); @@ -52,7 +52,7 @@ foreach ($stats as $group) { 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" ; @@ -150,7 +150,7 @@ function getServerKeys($server) } } 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; } diff --git a/bin/translateAttributes.php b/bin/translateAttributes.php index 07cf01218..7ed0a2111 100755 --- a/bin/translateAttributes.php +++ b/bin/translateAttributes.php @@ -38,11 +38,11 @@ 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)) { - $defs['attribute_'.$lower] = []; + if (!array_key_exists('attribute_' . $lower, $defs)) { + $defs['attribute_' . $lower] = []; } if (!array_key_exists('attribute_' . $lower, $trans)) { - $trans['attribute_'.$lower] = []; + $trans['attribute_' . $lower] = []; } if (array_key_exists('no', $trans['attribute_' . $lower])) { // fix the locale code @@ -87,8 +87,9 @@ foreach (array_keys($languages) as $language) { continue; } $translation = new Gettext\Translation('', $name); - if (array_key_exists($language, $attribute['translations']) && - !is_null($attribute['translations'][$language]) + if ( + array_key_exists($language, $attribute['translations']) + && !is_null($attribute['translations'][$language]) ) { $t = $strings->find($translation); if ($t) { diff --git a/phpcs.xml b/phpcs.xml index f0fd05728..15c8459e5 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -29,6 +29,7 @@ <exclude-pattern>modules/saml/lib/IdP/SAML1.php</exclude-pattern> <exclude-pattern>modules/saml/www/sp/saml1-acs.php</exclude-pattern> <exclude-pattern>tests/lib/SimpleSAML/Auth/TimeLimitedTokenTest.php</exclude-pattern> + <exclude-pattern>www/shib13</exclude-pattern> <!-- Exclude old PHP templates; they are removed in SSP 2.0 --> <exclude-pattern>modules/*/templates/*.tpl.php</exclude-pattern> diff --git a/www/saml2/idp/metadata.php b/www/saml2/idp/metadata.php index fe741a1d3..bbc874ef4 100644 --- a/www/saml2/idp/metadata.php +++ b/www/saml2/idp/metadata.php @@ -147,7 +147,9 @@ try { ); if (!$idpmeta->hasValue('OrganizationURL')) { - throw new \SimpleSAML\Error\Exception('If OrganizationName is set, OrganizationURL must also be set.'); + throw new \SimpleSAML\Error\Exception( + 'If OrganizationName is set, OrganizationURL must also be set.' + ); } $metaArray['OrganizationURL'] = $idpmeta->getLocalizedString('OrganizationURL'); } -- GitLab