Function apply
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function apply(RequestContextInterface $requestContext, ResponseInterface $response, array $serverBackreferences)
{
// First of all we have to resolve the target string with the backreferences of the matching condition
// Separate the keys from the values so we can use them in str_replace
// And also mix in the server's backreferences for good measure
- Read upRead up
- Create a ticketCreate a ticket
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 matches
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function matches()
{
// We will iterate over all conditions (and the or-combined condition groups) and if there is a non-matching
// condition or condition group we will fail
foreach ($this->sortedConditions as $sortedCondition) {
- Read upRead up
- Create a ticketCreate a ticket
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 apply
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function apply(RequestContextInterface $requestContext, ResponseInterface $response, array $serverBackreferences)
{
// First of all we have to resolve the target string with the backreferences of the matching condition
// Separate the keys from the values so we can use them in str_replace
// And also mix in the server's backreferences for good measure
- Create a ticketCreate a ticket
Method __construct
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($conditionString, $target, $flagString)
{
// Set the raw string properties and append our default operand to the condition string
$this->conditionString = $conditionString;
$conditionString .= $this->getDefaultOperand();
- Create a ticketCreate a ticket
Function __construct
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($conditionString, $target, $flagString)
{
// Set the raw string properties and append our default operand to the condition string
$this->conditionString = $conditionString;
$conditionString .= $this->getDefaultOperand();
- Read upRead up
- Create a ticketCreate a ticket
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 getBackreferences
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getBackreferences()
{
// Iterate over all conditions and collect their backreferences
$backreferences = array();
foreach ($this->sortedConditions as $key => $sortedCondition) {
- Read upRead up
- Create a ticketCreate a ticket
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 resolveConditions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function resolveConditions(array $backreferences)
{
// Iterate over all conditions and resolve them too
foreach ($this->sortedConditions as $key => $sortedCondition) {
// If we got an array we have to iterate over it separately, but be aware they are or-combined
- Read upRead up
- Create a ticketCreate a ticket
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"