Showing 8 of 8 total issues
Function findOrigin
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function findOrigin(
string|array $ignoreClasses = [],
string|array $ignoreNamespaces = [],
): Origin {
$ignoreClassesArray = self::convertToArray($ignoreClasses);
- 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 findOrigin
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function findOrigin(
string|array $ignoreClasses = [],
string|array $ignoreNamespaces = [],
): Origin {
$ignoreClassesArray = self::convertToArray($ignoreClasses);
Method createException
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function createException(
string $exceptionClass,
string $message,
string|array $ignoreClasses = [],
string|array $ignoreNamespaces = [],
Function sanitizeData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function sanitizeData(mixed $data): string
{
// Convert object to class name
if (\is_object($data)) {
return 'object(' . (new \ReflectionClass($data))->getName() . ')';
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private string $originCall,
/** @var string File in which the problem originated */
private string $originFile,
/** @var int Line on which the problem originated */
private int $originLine,
Method createException
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
string $exceptionClass,
string $message,
string|array $ignoreClasses = [],
string|array $ignoreNamespaces = [],
?\Throwable $previousException = null,
Avoid too many return
statements within this method. Open
Open
return '[' . \implode(', ', $result) . ']';
Avoid too many return
statements within this method. Open
Open
return \str_replace("\n", '', \var_export($data, true));