src/Davispeixoto/ForceDotComToolkitForPhp/SObject.php
Function __construct
has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring. Open
Open
public function __construct($response = null)
{
if (!isset($response) && !$response) {
return;
}
- 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 xml2array
has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring. Open
Open
public function xml2array($contents, $get_attributes = 1)
{
if (!$contents) {
return array();
}
- 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 xml2array
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function xml2array($contents, $get_attributes = 1)
{
if (!$contents) {
return array();
}
Method __construct
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function __construct($response = null)
{
if (!isset($response) && !$response) {
return;
}
Consider simplifying this complex logical expression. Open
Open
if ((is_array($current[$tag]) && $get_attributes == 0)//If it is already an array...
|| (isset($current[$tag][0]) && is_array($current[$tag][0]) && ($get_attributes == 1 || $get_attributes == 2))
) {
array_push($current[$tag], $result); // ...push the new element into that array.
} else { //If it is not an array...