diff --git a/ecs.php b/ecs.php index 9c9fdb6199a4bba5ce04c9b286ae26daaad41a7f..5ca84fec4f7fb21ead07e2f2cf5c51ad2fb89f2d 100644 --- a/ecs.php +++ b/ecs.php @@ -2,43 +2,34 @@ declare(strict_types=1); -use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer; -use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; -use Symplify\EasyCodingStandard\ValueObject\Option; +use PhpCsFixer\Fixer\FunctionNotation\FunctionTypehintSpaceFixer; +use PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer; +use Symplify\EasyCodingStandard\Config\ECSConfig; use Symplify\EasyCodingStandard\ValueObject\Set\SetList; -return static function (ContainerConfigurator $containerConfigurator): void { - $parameters = $containerConfigurator->parameters(); - $parameters->set(Option::PATHS, [ +return static function (ECSConfig $ecsConfig): void { + $ecsConfig->paths([ __DIR__ . '/ecs.php', __DIR__ . '/config-templates', - __DIR__ . '/dictionaries', __DIR__ . '/lib', __DIR__ . '/themes', __DIR__ . '/www', - __DIR__ . '/composer.json', ]); - $parameters->set(Option::PARALLEL, true); - $parameters->set(Option::SKIP, [NotOperatorWithSuccessorSpaceFixer::class, FunctionTypehintSpaceFixer::class]); - $containerConfigurator->import(SetList::PHP_CS_FIXER); - $containerConfigurator->import(SetList::CLEAN_CODE); - $containerConfigurator->import(SetList::SYMPLIFY); - $containerConfigurator->import(SetList::ARRAY); - $containerConfigurator->import(SetList::COMMON); - $containerConfigurator->import(SetList::COMMENTS); - $containerConfigurator->import(SetList::CONTROL_STRUCTURES); - $containerConfigurator->import(SetList::DOCBLOCK); - $containerConfigurator->import(SetList::NAMESPACES); - $containerConfigurator->import(SetList::PHPUNIT); - $containerConfigurator->import(SetList::SPACES); - $containerConfigurator->import(SetList::STRICT); - $containerConfigurator->import(SetList::SYMFONY); - $containerConfigurator->import(SetList::PSR_12); - $services = $containerConfigurator->services(); - $services->set(ArraySyntaxFixer::class) - ->call('configure', [[ - 'syntax' => 'short', - ]]) - ; + $ecsConfig->sets([ + SetList::CLEAN_CODE, + SetList::SYMPLIFY, + SetList::ARRAY, + SetList::COMMON, + SetList::COMMENTS, + SetList::CONTROL_STRUCTURES, + SetList::DOCBLOCK, + SetList::NAMESPACES, + SetList::PHPUNIT, + SetList::SPACES, + SetList::STRICT, + SetList::PSR_12, + ]); + + $ecsConfig->skip([NotOperatorWithSuccessorSpaceFixer::class, FunctionTypehintSpaceFixer::class]); }; diff --git a/lib/Auth/Process/ComputeLoA.php b/lib/Auth/Process/ComputeLoA.php index 7d4475bb26754547695740c62793c4f0b66ea446..8103bb9b65494a361411b26f80b2e31c64267848 100644 --- a/lib/Auth/Process/ComputeLoA.php +++ b/lib/Auth/Process/ComputeLoA.php @@ -75,7 +75,7 @@ class ComputeLoA extends \SimpleSAML\Auth\ProcessingFilter } foreach ($entityCategoryAttributes as $entityCategoryAttribute) { - if (self::EDUID_IDP_GROUP === substr($entityCategoryAttribute, 0, strlen(self::EDUID_IDP_GROUP))) { + if (substr($entityCategoryAttribute, 0, strlen(self::EDUID_IDP_GROUP)) === self::EDUID_IDP_GROUP) { $this->entityCategory = substr( $entityCategoryAttribute, strlen(self::EDUID_IDP_GROUP), @@ -97,10 +97,10 @@ class ComputeLoA extends \SimpleSAML\Auth\ProcessingFilter */ private function getLoA() { - if (null === $this->entityCategory || empty($this->entityCategory)) { + if ($this->entityCategory === null || empty($this->entityCategory)) { return 0; } - if (self::UNIVERSITY === $this->entityCategory) { + if ($this->entityCategory === self::UNIVERSITY) { foreach ($this->eduPersonScopedAffiliation as $affiliation) { if (preg_match( '/(^employee@.+\.cz$)|' . @@ -115,25 +115,25 @@ class ComputeLoA extends \SimpleSAML\Auth\ProcessingFilter return 2; } } - } elseif (self::AVCR === $this->entityCategory) { + } elseif ($this->entityCategory === self::AVCR) { foreach ($this->eduPersonScopedAffiliation as $affiliation) { if (preg_match('/^member@.+\.cz$/', $affiliation, $matches)) { return 2; } } - } elseif (self::LIBRARY === $this->entityCategory) { + } elseif ($this->entityCategory === self::LIBRARY) { foreach ($this->eduPersonScopedAffiliation as $affiliation) { if (preg_match('/^employee@.+\.cz$/', $affiliation, $matches)) { return 2; } } - } elseif (self::HOSPITAL === $this->entityCategory) { + } elseif ($this->entityCategory === self::HOSPITAL) { foreach ($this->eduPersonScopedAffiliation as $affiliation) { if (preg_match('/^employee@.+\.cz$/', $affiliation, $matches)) { return 2; } } - } elseif (self::OTHER === $this->entityCategory) { + } elseif ($this->entityCategory === self::OTHER) { foreach ($this->eduPersonScopedAffiliation as $affiliation) { if (preg_match('/(^employee@.+\.cz$)|(^member@.+\.cz$)/', $affiliation, $matches)) { return 2; diff --git a/lib/Auth/Process/IsCesnetEligible.php b/lib/Auth/Process/IsCesnetEligible.php index 33c584623a707123db83520a9a84ac4b5f14baff..9c5dae2da7ce866ac6087233b46ac3b3151327d5 100644 --- a/lib/Auth/Process/IsCesnetEligible.php +++ b/lib/Auth/Process/IsCesnetEligible.php @@ -85,7 +85,7 @@ class IsCesnetEligible extends ProcessingFilter { parent::__construct($config, $reserved); $conf = Configuration::loadFromArray($config); - if (! isset($config[self::RPC_ATTRIBUTE_NAME]) || empty($config[self::RPC_ATTRIBUTE_NAME])) { + if (!isset($config[self::RPC_ATTRIBUTE_NAME]) || empty($config[self::RPC_ATTRIBUTE_NAME])) { throw new Exception( 'cesnet:IsCesnetEligible - missing mandatory configuration option \'' . self::RPC_ATTRIBUTE_NAME . '\'.' ); @@ -96,12 +96,12 @@ class IsCesnetEligible extends ProcessingFilter $this->cesnetLdapConnector = (new AdapterLdap(self::CONFIG_FILE_NAME))->getConnector(); $this->rpcAdapter = Adapter::getInstance(Adapter::RPC); - if (isset($config[self::ATTR_NAME]) && ! empty($config[self::ATTR_NAME])) { + if (isset($config[self::ATTR_NAME]) && !empty($config[self::ATTR_NAME])) { $this->returnAttrName = $config['attrName']; } if (isset($config[self::INTERFACE_PROPNAME], $config[self::LDAP_ATTRIBUTE_NAME]) && - self::LDAP === $config[self::INTERFACE_PROPNAME] && ! empty($config[self::LDAP_ATTRIBUTE_NAME])) { + $config[self::INTERFACE_PROPNAME] === self::LDAP && !empty($config[self::LDAP_ATTRIBUTE_NAME])) { $this->interface = $config[self::INTERFACE_PROPNAME]; $this->ldapAttrName = $config[self::LDAP_ATTRIBUTE_NAME]; $this->adapter = Adapter::getInstance(Adapter::LDAP); @@ -117,7 +117,7 @@ class IsCesnetEligible extends ProcessingFilter $conf->getString(self::PERUN_USER_SPONSORING_ORGANIZATIONS_ATTR_NAME, null); $this->userAffiliationsAttrName = $conf->getString(self::PERUN_USER_AFFILIATIONS_ATTR_NAME, null); - if (! isset($this->userAffiliationsAttrName, $this->userSponsoringOrganizationsAttrName)) { + if (!isset($this->userAffiliationsAttrName, $this->userSponsoringOrganizationsAttrName)) { Logger::warning( 'cesnet:IsCesnetEligible - One of attributes [' . $this->userAffiliationsAttrName . ', ' . $this->userSponsoringOrganizationsAttrName . '] wasn\'t set!' @@ -148,8 +148,8 @@ class IsCesnetEligible extends ProcessingFilter ); } - if (! empty($user)) { - if (self::LDAP === $this->interface) { + if (!empty($user)) { + if ($this->interface === self::LDAP) { $attrs = $this->adapter->getUserAttributes($user, [$this->ldapAttrName]); if (isset($attrs[$this->ldapAttrName][0])) { $this->cesnetEligibleLastSeenValue = $attrs[$this->ldapAttrName][0]; @@ -162,10 +162,10 @@ class IsCesnetEligible extends ProcessingFilter } } - if (! empty($this->eduPersonScopedAffiliation) && $this->isCesnetEligible($user)) { + if (!empty($this->eduPersonScopedAffiliation) && $this->isCesnetEligible($user)) { $this->cesnetEligibleLastSeenValue = date('Y-m-d H:i:s'); - if (! empty($user)) { + if (!empty($user)) { // Update attribute 'isCesnetEligible' in Perun $id = uniqid('', true); @@ -187,7 +187,7 @@ class IsCesnetEligible extends ProcessingFilter } } - if (null !== $this->cesnetEligibleLastSeenValue) { + if ($this->cesnetEligibleLastSeenValue !== null) { $request['Attributes'][$this->returnAttrName] = [$this->cesnetEligibleLastSeenValue]; Logger::debug( 'cesnet:IsCesnetEligible - Attribute ' . $this->returnAttrName . ' was set to value ' . @@ -196,7 +196,7 @@ class IsCesnetEligible extends ProcessingFilter } $request['Attributes']['isCesnetEligible'] = ['false']; - if ((null !== $this->cesnetEligibleLastSeenValue) && $this->cesnetEligibleLastSeenValue > date( + if (($this->cesnetEligibleLastSeenValue !== null) && $this->cesnetEligibleLastSeenValue > date( 'Y-m-d H:i:s', strtotime('-1 year') )) { @@ -306,7 +306,7 @@ class IsCesnetEligible extends ProcessingFilter private function compareAffiliations($userAffiliations, $allowedAffiliations): bool { $result = array_intersect($userAffiliations, $allowedAffiliations); - if (! empty($result)) { + if (!empty($result)) { return true; } diff --git a/themes/cesnet/default/includes/footer.php b/themes/cesnet/default/includes/footer.php index e3259c9e589bca5fff486bc7d70e39c306389ef9..fd99bb039242ec2d7757b4898c7ab00e8d22899c 100644 --- a/themes/cesnet/default/includes/footer.php +++ b/themes/cesnet/default/includes/footer.php @@ -2,7 +2,7 @@ use SimpleSAML\Module; -if (! empty($this->data['htmlinject']['htmlContentPost'])) { +if (!empty($this->data['htmlinject']['htmlContentPost'])) { foreach ($this->data['htmlinject']['htmlContentPost'] as $c) { echo $c; } diff --git a/themes/cesnet/default/includes/header.php b/themes/cesnet/default/includes/header.php index 8eb3bd3ac02315d3e2bcde93fd4c9f00e399426e..9675720ec7ce3a043639cd7b65a93c9030550fa7 100644 --- a/themes/cesnet/default/includes/header.php +++ b/themes/cesnet/default/includes/header.php @@ -60,13 +60,13 @@ header('X-Frame-Options: SAMEORIGIN'); <?php - if (! empty($jquery)) { + if (!empty($jquery)) { $version = '1.8'; if (array_key_exists('version', $jquery)) { $version = $jquery['version']; } - if ('1.8' === $version) { + if ($version === '1.8') { if (isset($jquery['core']) && $jquery['core']) { echo '<script type="text/javascript" src="/' . $this->data['baseurlpath'] . 'resources/jquery-1.8.js"></script>' . "\n" @@ -91,7 +91,7 @@ header('X-Frame-Options: SAMEORIGIN'); 'resources/clipboard.min.js"></script>' . "\n"; } - if (! empty($this->data['htmlinject']['htmlContentHead'])) { + if (!empty($this->data['htmlinject']['htmlContentHead'])) { foreach ($this->data['htmlinject']['htmlContentHead'] as $c) { echo $c; } @@ -132,7 +132,7 @@ if (isset($this->data['onLoad'])) { $onLoad .= $this->data['onLoad']; } -if ('' !== $onLoad) { +if ($onLoad !== '') { $onLoad = ' onload="' . $onLoad . '"'; } @@ -146,7 +146,7 @@ if ('' !== $onLoad) { <?php $includeLanguageBar = true; - if (isset($this->data['hideLanguageBar']) && true === $this->data['hideLanguageBar']) { + if (isset($this->data['hideLanguageBar']) && $this->data['hideLanguageBar'] === true) { $includeLanguageBar = false; } @@ -266,7 +266,7 @@ if ('' !== $onLoad) { <?php -if (! empty($this->data['htmlinject']['htmlContentPre'])) { +if (!empty($this->data['htmlinject']['htmlContentPre'])) { foreach ($this->data['htmlinject']['htmlContentPre'] as $c) { echo $c; } diff --git a/themes/cesnet/perun/disco-tpl.php b/themes/cesnet/perun/disco-tpl.php index fee9ce5cbae5ee87caa8c3698f30900fcab57155..56c8b39856f70a1704a009ddc05b48e98cab5e7b 100644 --- a/themes/cesnet/perun/disco-tpl.php +++ b/themes/cesnet/perun/disco-tpl.php @@ -62,19 +62,19 @@ $this->data['jquery'] = [ ]; $this->includeAtTemplateBase('includes/header.php'); -if (null !== $authContextClassRef) { +if ($authContextClassRef !== null) { foreach ($authContextClassRef as $value) { - if (URN_CESNET_PROXYIDP_FILTER === substr($value, 0, strlen(URN_CESNET_PROXYIDP_FILTER))) { + if (substr($value, 0, strlen(URN_CESNET_PROXYIDP_FILTER)) === URN_CESNET_PROXYIDP_FILTER) { $filter = substr($value, strlen(URN_CESNET_PROXYIDP_FILTER), strlen($value)); - } elseif (URN_CESNET_PROXYIDP_EFILTER === substr($value, 0, strlen(URN_CESNET_PROXYIDP_EFILTER))) { + } elseif (substr($value, 0, strlen(URN_CESNET_PROXYIDP_EFILTER)) === URN_CESNET_PROXYIDP_EFILTER) { $efilter = substr($value, strlen(URN_CESNET_PROXYIDP_EFILTER), strlen($value)); - } elseif (URN_CESNET_PROXYIDP_IDPENTITYID === substr($value, 0, strlen(URN_CESNET_PROXYIDP_IDPENTITYID))) { + } elseif (substr($value, 0, strlen(URN_CESNET_PROXYIDP_IDPENTITYID)) === URN_CESNET_PROXYIDP_IDPENTITYID) { $idpEntityId = substr($value, strlen(URN_CESNET_PROXYIDP_IDPENTITYID), strlen($value)); } } } -if (null !== $idpEntityId) { +if ($idpEntityId !== null) { $url = $this->getContinueUrl($idpEntityId); HTTP::redirectTrustedURL($url); @@ -83,11 +83,11 @@ if (null !== $idpEntityId) { $url = $this->getContinueUrlWithoutIdPEntityId(); if ($warningAttributes->isEnabled()) { - if (WarningConfiguration::WARNING_TYPE_INFO === $warningAttributes->getType()) { + if ($warningAttributes->getType() === WarningConfiguration::WARNING_TYPE_INFO) { echo '<div class="alert alert-info">'; - } elseif (WarningConfiguration::WARNING_TYPE_WARNING === $warningAttributes->getType()) { + } elseif ($warningAttributes->getType() === WarningConfiguration::WARNING_TYPE_WARNING) { echo '<div class="alert alert-warning">'; - } elseif (WarningConfiguration::WARNING_TYPE_ERROR === $warningAttributes->getType()) { + } elseif ($warningAttributes->getType() === WarningConfiguration::WARNING_TYPE_ERROR) { echo '<div class="alert alert-danger">'; } echo '<h4> <strong>' . $warningAttributes->getTitle() . '</strong> </h4>'; @@ -108,18 +108,18 @@ if (null !== $idpEntityId) { if ($canContinue && ( - ! $warningAttributes->isEnabled() || + !$warningAttributes->isEnabled() || in_array( $warningAttributes->getType(), [WarningConfiguration::WARNING_TYPE_INFO, WarningConfiguration::WARNING_TYPE_WARNING], true ) )) { - if (null !== $efilter) { + if ($efilter !== null) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&efilter=' . $efilter); exit; } - if (null !== $filter) { + if ($filter !== null) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&filter=' . $filter); exit; } @@ -133,11 +133,11 @@ if (null !== $idpEntityId) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&filter=' . $filter); exit; } - if (null !== $defaultEFilter) { + if ($defaultEFilter !== null) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&efilter=' . $defaultEFilter); exit; } - if (null !== $defaultFilter) { + if ($defaultFilter !== null) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&filter=' . $defaultFilter); exit; } diff --git a/themes/einfra/core/loginuserpass.php b/themes/einfra/core/loginuserpass.php index 0b9dd3c59f0aa7d0d024fdcb45e9831e88b55150..8372ced71fc72ea475dbaeb16a76fe77d45ee50d 100644 --- a/themes/einfra/core/loginuserpass.php +++ b/themes/einfra/core/loginuserpass.php @@ -10,7 +10,7 @@ if (strlen($this->data['username']) > 0) { $this->includeAtTemplateBase('includes/header.php'); -if (null !== $this->data['errorcode']) { +if ($this->data['errorcode'] !== null) { ?> <div class="alert alert-danger"> <span class="glyphicon glyphicon-exclamation-sign" @@ -45,7 +45,7 @@ if (null !== $this->data['errorcode']) { <input id="username" <?php echo ($this->data['forceUsername']) ? 'disabled="disabled"' : ''; ?> type="text" name="username" class="form-control" <?php - if (! $this->data['forceUsername']) { + if (!$this->data['forceUsername']) { echo 'tabindex="1"'; } ?> value="<?php echo htmlspecialchars($this->data['username']); ?>"/> @@ -60,7 +60,7 @@ if (null !== $this->data['errorcode']) { </div> <?php - if ($this->data['rememberUsernameEnabled'] && ! $this->data['forceUsername']) { + if ($this->data['rememberUsernameEnabled'] && !$this->data['forceUsername']) { // display the "remember my username" checkbox?> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> @@ -155,7 +155,7 @@ if (null !== $this->data['errorcode']) { <?php -if (! empty($this->data['links'])) { +if (!empty($this->data['links'])) { echo '<ul class="links" style="margin-top: 2em">'; foreach ($this->data['links'] as $l) { echo '<li>' . diff --git a/themes/einfra/default/includes/footer.php b/themes/einfra/default/includes/footer.php index 0ef1ba1c910af1781f2892e91fa2e5f5223151a4..cc5a35b2de4a46b622237b8748ffe3885cd50cd0 100644 --- a/themes/einfra/default/includes/footer.php +++ b/themes/einfra/default/includes/footer.php @@ -2,7 +2,7 @@ use SimpleSAML\Module; -if (! empty($this->data['htmlinject']['htmlContentPost'])) { +if (!empty($this->data['htmlinject']['htmlContentPost'])) { foreach ($this->data['htmlinject']['htmlContentPost'] as $c) { echo $c; } diff --git a/themes/einfra/default/includes/header.php b/themes/einfra/default/includes/header.php index d4ca36ac060bdfb8efd90089f713d65561109f45..1dbe6872278d02e2ec2df398f60d79123707e180 100644 --- a/themes/einfra/default/includes/header.php +++ b/themes/einfra/default/includes/header.php @@ -60,13 +60,13 @@ header('X-Frame-Options: SAMEORIGIN'); <?php - if (! empty($jquery)) { + if (!empty($jquery)) { $version = '1.8'; if (array_key_exists('version', $jquery)) { $version = $jquery['version']; } - if ('1.8' === $version) { + if ($version === '1.8') { if (isset($jquery['core']) && $jquery['core']) { echo '<script type="text/javascript" src="/' . $this->data['baseurlpath'] . 'resources/jquery-1.8.js"></script>' . "\n" @@ -91,7 +91,7 @@ header('X-Frame-Options: SAMEORIGIN'); 'resources/clipboard.min.js"></script>' . "\n"; } - if (! empty($this->data['htmlinject']['htmlContentHead'])) { + if (!empty($this->data['htmlinject']['htmlContentHead'])) { foreach ($this->data['htmlinject']['htmlContentHead'] as $c) { echo $c; } @@ -132,7 +132,7 @@ if (isset($this->data['onLoad'])) { $onLoad .= $this->data['onLoad']; } -if ('' !== $onLoad) { +if ($onLoad !== '') { $onLoad = ' onload="' . $onLoad . '"'; } @@ -146,7 +146,7 @@ if ('' !== $onLoad) { <?php $includeLanguageBar = true; - if (isset($this->data['hideLanguageBar']) && true === $this->data['hideLanguageBar']) { + if (isset($this->data['hideLanguageBar']) && $this->data['hideLanguageBar'] === true) { $includeLanguageBar = false; } @@ -266,7 +266,7 @@ if ('' !== $onLoad) { <?php -if (! empty($this->data['htmlinject']['htmlContentPre'])) { +if (!empty($this->data['htmlinject']['htmlContentPre'])) { foreach ($this->data['htmlinject']['htmlContentPre'] as $c) { echo $c; } diff --git a/themes/einfra/perun/disco-tpl.php b/themes/einfra/perun/disco-tpl.php index fee9ce5cbae5ee87caa8c3698f30900fcab57155..56c8b39856f70a1704a009ddc05b48e98cab5e7b 100644 --- a/themes/einfra/perun/disco-tpl.php +++ b/themes/einfra/perun/disco-tpl.php @@ -62,19 +62,19 @@ $this->data['jquery'] = [ ]; $this->includeAtTemplateBase('includes/header.php'); -if (null !== $authContextClassRef) { +if ($authContextClassRef !== null) { foreach ($authContextClassRef as $value) { - if (URN_CESNET_PROXYIDP_FILTER === substr($value, 0, strlen(URN_CESNET_PROXYIDP_FILTER))) { + if (substr($value, 0, strlen(URN_CESNET_PROXYIDP_FILTER)) === URN_CESNET_PROXYIDP_FILTER) { $filter = substr($value, strlen(URN_CESNET_PROXYIDP_FILTER), strlen($value)); - } elseif (URN_CESNET_PROXYIDP_EFILTER === substr($value, 0, strlen(URN_CESNET_PROXYIDP_EFILTER))) { + } elseif (substr($value, 0, strlen(URN_CESNET_PROXYIDP_EFILTER)) === URN_CESNET_PROXYIDP_EFILTER) { $efilter = substr($value, strlen(URN_CESNET_PROXYIDP_EFILTER), strlen($value)); - } elseif (URN_CESNET_PROXYIDP_IDPENTITYID === substr($value, 0, strlen(URN_CESNET_PROXYIDP_IDPENTITYID))) { + } elseif (substr($value, 0, strlen(URN_CESNET_PROXYIDP_IDPENTITYID)) === URN_CESNET_PROXYIDP_IDPENTITYID) { $idpEntityId = substr($value, strlen(URN_CESNET_PROXYIDP_IDPENTITYID), strlen($value)); } } } -if (null !== $idpEntityId) { +if ($idpEntityId !== null) { $url = $this->getContinueUrl($idpEntityId); HTTP::redirectTrustedURL($url); @@ -83,11 +83,11 @@ if (null !== $idpEntityId) { $url = $this->getContinueUrlWithoutIdPEntityId(); if ($warningAttributes->isEnabled()) { - if (WarningConfiguration::WARNING_TYPE_INFO === $warningAttributes->getType()) { + if ($warningAttributes->getType() === WarningConfiguration::WARNING_TYPE_INFO) { echo '<div class="alert alert-info">'; - } elseif (WarningConfiguration::WARNING_TYPE_WARNING === $warningAttributes->getType()) { + } elseif ($warningAttributes->getType() === WarningConfiguration::WARNING_TYPE_WARNING) { echo '<div class="alert alert-warning">'; - } elseif (WarningConfiguration::WARNING_TYPE_ERROR === $warningAttributes->getType()) { + } elseif ($warningAttributes->getType() === WarningConfiguration::WARNING_TYPE_ERROR) { echo '<div class="alert alert-danger">'; } echo '<h4> <strong>' . $warningAttributes->getTitle() . '</strong> </h4>'; @@ -108,18 +108,18 @@ if (null !== $idpEntityId) { if ($canContinue && ( - ! $warningAttributes->isEnabled() || + !$warningAttributes->isEnabled() || in_array( $warningAttributes->getType(), [WarningConfiguration::WARNING_TYPE_INFO, WarningConfiguration::WARNING_TYPE_WARNING], true ) )) { - if (null !== $efilter) { + if ($efilter !== null) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&efilter=' . $efilter); exit; } - if (null !== $filter) { + if ($filter !== null) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&filter=' . $filter); exit; } @@ -133,11 +133,11 @@ if (null !== $idpEntityId) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&filter=' . $filter); exit; } - if (null !== $defaultEFilter) { + if ($defaultEFilter !== null) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&efilter=' . $defaultEFilter); exit; } - if (null !== $defaultFilter) { + if ($defaultFilter !== null) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&filter=' . $defaultFilter); exit; } diff --git a/themes/einfra_idp/core/loginuserpass.php b/themes/einfra_idp/core/loginuserpass.php index 0b9dd3c59f0aa7d0d024fdcb45e9831e88b55150..8372ced71fc72ea475dbaeb16a76fe77d45ee50d 100644 --- a/themes/einfra_idp/core/loginuserpass.php +++ b/themes/einfra_idp/core/loginuserpass.php @@ -10,7 +10,7 @@ if (strlen($this->data['username']) > 0) { $this->includeAtTemplateBase('includes/header.php'); -if (null !== $this->data['errorcode']) { +if ($this->data['errorcode'] !== null) { ?> <div class="alert alert-danger"> <span class="glyphicon glyphicon-exclamation-sign" @@ -45,7 +45,7 @@ if (null !== $this->data['errorcode']) { <input id="username" <?php echo ($this->data['forceUsername']) ? 'disabled="disabled"' : ''; ?> type="text" name="username" class="form-control" <?php - if (! $this->data['forceUsername']) { + if (!$this->data['forceUsername']) { echo 'tabindex="1"'; } ?> value="<?php echo htmlspecialchars($this->data['username']); ?>"/> @@ -60,7 +60,7 @@ if (null !== $this->data['errorcode']) { </div> <?php - if ($this->data['rememberUsernameEnabled'] && ! $this->data['forceUsername']) { + if ($this->data['rememberUsernameEnabled'] && !$this->data['forceUsername']) { // display the "remember my username" checkbox?> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> @@ -155,7 +155,7 @@ if (null !== $this->data['errorcode']) { <?php -if (! empty($this->data['links'])) { +if (!empty($this->data['links'])) { echo '<ul class="links" style="margin-top: 2em">'; foreach ($this->data['links'] as $l) { echo '<li>' . diff --git a/themes/einfra_idp/default/includes/footer.php b/themes/einfra_idp/default/includes/footer.php index 0ef1ba1c910af1781f2892e91fa2e5f5223151a4..cc5a35b2de4a46b622237b8748ffe3885cd50cd0 100644 --- a/themes/einfra_idp/default/includes/footer.php +++ b/themes/einfra_idp/default/includes/footer.php @@ -2,7 +2,7 @@ use SimpleSAML\Module; -if (! empty($this->data['htmlinject']['htmlContentPost'])) { +if (!empty($this->data['htmlinject']['htmlContentPost'])) { foreach ($this->data['htmlinject']['htmlContentPost'] as $c) { echo $c; } diff --git a/themes/einfra_idp/default/includes/header.php b/themes/einfra_idp/default/includes/header.php index d70b05ca3f3cafbdc5445392597302d67d24b09f..ade58eb383e56b8b8f142dbcf74ab28d45c6aa41 100644 --- a/themes/einfra_idp/default/includes/header.php +++ b/themes/einfra_idp/default/includes/header.php @@ -60,13 +60,13 @@ header('X-Frame-Options: SAMEORIGIN'); <?php - if (! empty($jquery)) { + if (!empty($jquery)) { $version = '1.8'; if (array_key_exists('version', $jquery)) { $version = $jquery['version']; } - if ('1.8' === $version) { + if ($version === '1.8') { if (isset($jquery['core']) && $jquery['core']) { echo '<script type="text/javascript" src="/' . $this->data['baseurlpath'] . 'resources/jquery-1.8.js"></script>' . "\n" @@ -91,7 +91,7 @@ header('X-Frame-Options: SAMEORIGIN'); 'resources/clipboard.min.js"></script>' . "\n"; } - if (! empty($this->data['htmlinject']['htmlContentHead'])) { + if (!empty($this->data['htmlinject']['htmlContentHead'])) { foreach ($this->data['htmlinject']['htmlContentHead'] as $c) { echo $c; } @@ -132,7 +132,7 @@ if (isset($this->data['onLoad'])) { $onLoad .= $this->data['onLoad']; } -if ('' !== $onLoad) { +if ($onLoad !== '') { $onLoad = ' onload="' . $onLoad . '"'; } @@ -146,7 +146,7 @@ if ('' !== $onLoad) { <?php $includeLanguageBar = true; - if (isset($this->data['hideLanguageBar']) && true === $this->data['hideLanguageBar']) { + if (isset($this->data['hideLanguageBar']) && $this->data['hideLanguageBar'] === true) { $includeLanguageBar = false; } @@ -266,7 +266,7 @@ if ('' !== $onLoad) { <?php -if (! empty($this->data['htmlinject']['htmlContentPre'])) { +if (!empty($this->data['htmlinject']['htmlContentPre'])) { foreach ($this->data['htmlinject']['htmlContentPre'] as $c) { echo $c; } diff --git a/themes/einfra_idp/perun/disco-tpl.php b/themes/einfra_idp/perun/disco-tpl.php index fee9ce5cbae5ee87caa8c3698f30900fcab57155..56c8b39856f70a1704a009ddc05b48e98cab5e7b 100644 --- a/themes/einfra_idp/perun/disco-tpl.php +++ b/themes/einfra_idp/perun/disco-tpl.php @@ -62,19 +62,19 @@ $this->data['jquery'] = [ ]; $this->includeAtTemplateBase('includes/header.php'); -if (null !== $authContextClassRef) { +if ($authContextClassRef !== null) { foreach ($authContextClassRef as $value) { - if (URN_CESNET_PROXYIDP_FILTER === substr($value, 0, strlen(URN_CESNET_PROXYIDP_FILTER))) { + if (substr($value, 0, strlen(URN_CESNET_PROXYIDP_FILTER)) === URN_CESNET_PROXYIDP_FILTER) { $filter = substr($value, strlen(URN_CESNET_PROXYIDP_FILTER), strlen($value)); - } elseif (URN_CESNET_PROXYIDP_EFILTER === substr($value, 0, strlen(URN_CESNET_PROXYIDP_EFILTER))) { + } elseif (substr($value, 0, strlen(URN_CESNET_PROXYIDP_EFILTER)) === URN_CESNET_PROXYIDP_EFILTER) { $efilter = substr($value, strlen(URN_CESNET_PROXYIDP_EFILTER), strlen($value)); - } elseif (URN_CESNET_PROXYIDP_IDPENTITYID === substr($value, 0, strlen(URN_CESNET_PROXYIDP_IDPENTITYID))) { + } elseif (substr($value, 0, strlen(URN_CESNET_PROXYIDP_IDPENTITYID)) === URN_CESNET_PROXYIDP_IDPENTITYID) { $idpEntityId = substr($value, strlen(URN_CESNET_PROXYIDP_IDPENTITYID), strlen($value)); } } } -if (null !== $idpEntityId) { +if ($idpEntityId !== null) { $url = $this->getContinueUrl($idpEntityId); HTTP::redirectTrustedURL($url); @@ -83,11 +83,11 @@ if (null !== $idpEntityId) { $url = $this->getContinueUrlWithoutIdPEntityId(); if ($warningAttributes->isEnabled()) { - if (WarningConfiguration::WARNING_TYPE_INFO === $warningAttributes->getType()) { + if ($warningAttributes->getType() === WarningConfiguration::WARNING_TYPE_INFO) { echo '<div class="alert alert-info">'; - } elseif (WarningConfiguration::WARNING_TYPE_WARNING === $warningAttributes->getType()) { + } elseif ($warningAttributes->getType() === WarningConfiguration::WARNING_TYPE_WARNING) { echo '<div class="alert alert-warning">'; - } elseif (WarningConfiguration::WARNING_TYPE_ERROR === $warningAttributes->getType()) { + } elseif ($warningAttributes->getType() === WarningConfiguration::WARNING_TYPE_ERROR) { echo '<div class="alert alert-danger">'; } echo '<h4> <strong>' . $warningAttributes->getTitle() . '</strong> </h4>'; @@ -108,18 +108,18 @@ if (null !== $idpEntityId) { if ($canContinue && ( - ! $warningAttributes->isEnabled() || + !$warningAttributes->isEnabled() || in_array( $warningAttributes->getType(), [WarningConfiguration::WARNING_TYPE_INFO, WarningConfiguration::WARNING_TYPE_WARNING], true ) )) { - if (null !== $efilter) { + if ($efilter !== null) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&efilter=' . $efilter); exit; } - if (null !== $filter) { + if ($filter !== null) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&filter=' . $filter); exit; } @@ -133,11 +133,11 @@ if (null !== $idpEntityId) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&filter=' . $filter); exit; } - if (null !== $defaultEFilter) { + if ($defaultEFilter !== null) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&efilter=' . $defaultEFilter); exit; } - if (null !== $defaultFilter) { + if ($defaultFilter !== null) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&filter=' . $defaultFilter); exit; }