File Telepath.php
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* *****************************************************************************
* Contributions to this work were made on behalf of the GÉANT project, a
Method genericAPIStatus
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function genericAPIStatus($type, $param1 = NULL, $param2 = NULL)
{
$endpoints = [
'tlr_test' => "https://monitor.eduroam.org/mapi/index.php?type=tlr_test&tlr=$param1",
'federation_via_tlr' => "https://monitor.eduroam.org/mapi/index.php?type=federation_via_tlr&federation=$param1",
Function genericAPIStatus
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private function genericAPIStatus($type, $param1 = NULL, $param2 = NULL)
{
$endpoints = [
'tlr_test' => "https://monitor.eduroam.org/mapi/index.php?type=tlr_test&tlr=$param1",
'federation_via_tlr' => "https://monitor.eduroam.org/mapi/index.php?type=federation_via_tlr&federation=$param1",
- 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 magic
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function magic()
{
$this->testId = \core\CAT::uuid();
$this->databaseHandle->exec("INSERT INTO diagnosticrun (test_id, realm, suspects, evidence) VALUES ('$this->testId', '$this->realm', NULL, NULL)");
// simple things first: do we know anything about the realm, either
Method CATInternalTests
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function CATInternalTests()
{
// we are expecting to get a REJECT from all runs, because that means the packet got through to the IdP.
// (the ETLR sometimes does a "Reject instead of Ignore" but that is filtered out and changed into a timeout
// by the test suite automatically, so it does not disturb the measurement)
Function magic
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function magic()
{
$this->testId = \core\CAT::uuid();
$this->databaseHandle->exec("INSERT INTO diagnosticrun (test_id, realm, suspects, evidence) VALUES ('$this->testId', '$this->realm', NULL, NULL)");
// simple things first: do we know anything about the realm, either
- 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 CATInternalTests
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function CATInternalTests()
{
// we are expecting to get a REJECT from all runs, because that means the packet got through to the IdP.
// (the ETLR sometimes does a "Reject instead of Ignore" but that is filtered out and changed into a timeout
// by the test suite automatically, so it does not disturb the measurement)
- 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 checkFedEtlrUplink
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function checkFedEtlrUplink($whichSide)
{
// TODO: we always check the European TLRs even though the connection in question might go via others and/or this one
// needs a table to determine what goes where :-(
switch ($whichSide) {
Consider simplifying this complex logical expression. Open
if ($this->idPFederation !== NULL &&
$this->visitedFlr !== NULL &&
!array_key_exists(AbstractTest::INFRA_ETLR, $this->possibleFailureReasons) &&
!array_key_exists(AbstractTest::INFRA_LINK_ETLR_NRO_IDP, $this->possibleFailureReasons) &&
!array_key_exists(AbstractTest::INFRA_NRO_IDP, $this->possibleFailureReasons) &&
Function checkFedEtlrUplink
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function checkFedEtlrUplink($whichSide)
{
// TODO: we always check the European TLRs even though the connection in question might go via others and/or this one
// needs a table to determine what goes where :-(
switch ($whichSide) {
- 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 $retval;
Function checkFlrServerStatus
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function checkFlrServerStatus($whichSide)
{
switch ($whichSide) {
case AbstractTest::INFRA_NRO_IDP:
$fed = $this->idPFederation;
- 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"