Function tlsClientSideCheck
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public function tlsClientSideCheck(string $host, string $ename, string $realm)
{
$res = RADIUSTests::RETVAL_OK;
if (!is_array(\config\Diagnostics::RADIUSTESTS['TLS-clientcerts']) || count(\config\Diagnostics::RADIUSTESTS['TLS-clientcerts']) == 0) {
return RADIUSTests::RETVAL_SKIPPED;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File RFC6614Tests.php
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* *****************************************************************************
* Contributions to this work were made on behalf of the GÉANT project, a
Function opensslCAResult
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function opensslCAResult($host, $opensslbabble)
{
if (preg_match('/connect: Connection refused/', implode($opensslbabble))) {
$this->TLS_CA_checks_result[$host]['status'] = RADIUSTests::RETVAL_CONNECTION_REFUSED;
return RADIUSTests::RETVAL_INVALID;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method tlsClientSideCheck
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function tlsClientSideCheck(string $host, string $ename, string $realm)
{
$res = RADIUSTests::RETVAL_OK;
if (!is_array(\config\Diagnostics::RADIUSTESTS['TLS-clientcerts']) || count(\config\Diagnostics::RADIUSTESTS['TLS-clientcerts']) == 0) {
return RADIUSTests::RETVAL_SKIPPED;
Method opensslCAResult
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function opensslCAResult($host, $opensslbabble)
{
if (preg_match('/connect: Connection refused/', implode($opensslbabble))) {
$this->TLS_CA_checks_result[$host]['status'] = RADIUSTests::RETVAL_CONNECTION_REFUSED;
return RADIUSTests::RETVAL_INVALID;
Method opensslClientsResult
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function opensslClientsResult($host, $opensslbabble, &$testresults, $type = '', $resultArrayKey = 0)
{
\core\common\Entity::intoThePotatoes();
$res = RADIUSTests::RETVAL_OK;
$ret = $testresults[$host]['ca'][$type]['certificate'][$resultArrayKey]['returncode'];
Function opensslClientsResult
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function opensslClientsResult($host, $opensslbabble, &$testresults, $type = '', $resultArrayKey = 0)
{
\core\common\Entity::intoThePotatoes();
$res = RADIUSTests::RETVAL_OK;
$ret = $testresults[$host]['ca'][$type]['certificate'][$resultArrayKey]['returncode'];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function checkServerName
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function checkServerName($host)
{
// it could match CN or sAN:DNS, we don't care which
if (isset($this->TLS_CA_checks_result[$host]['certdata']['subject'])) {
$this->loggerInstance->debug(4, "Checking expected server name " . $this->expectedName .
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method __construct
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($listOfIPs, $expectedName, $consortium = "eduroam")
{
parent::__construct();
\core\common\Entity::intoThePotatoes();
$this->TLS_certkeys = [
Method opensslClientsResult
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private function opensslClientsResult($host, $opensslbabble, &$testresults, $type = '', $resultArrayKey = 0)
Function getCertificateIssuer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getCertificateIssuer($cert)
{
$issuer = '';
foreach ($cert['issuer'] as $key => $val) {
if (is_array($val)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function propertyCheckPolicy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function propertyCheckPolicy($cert)
{
$oids = [];
if (isset($cert['extensions']['certificatePolicies']) && $cert['extensions']['certificatePolicies']) {
foreach (\config\Diagnostics::RADIUSTESTS['TLS-acceptableOIDs'] as $key => $oid) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return RADIUSTests::RETVAL_OK;
Avoid too many return
statements within this method. Open
return RADIUSTests::RETVAL_INVALID;