Showing 7 of 7 total issues
Function traverse
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private function traverse($node, int $level = 0): string
{
$xml = '';
$attributes = '';
$indent = str_repeat(' ', $level);
- 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
Converter
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class Converter implements \Iterator, \ArrayAccess
{
public $xml = '';
public $data = [];
File Converter.php
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* GreenCape XML Converter
*
* MIT License
Method traverse
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function traverse($node, int $level = 0): string
{
$xml = '';
$attributes = '';
$indent = str_repeat(' ', $level);
Method handleElementOpen
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function handleElementOpen(Stream $stream): void
{
// Skip '<'
$stream->next();
$element = $stream->readTo('>');
Function parse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function parse(): void
{
$this->stack[] =& $this->data;
$stream = new Stream(trim($this->xml));
- 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 handleElementOpen
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function handleElementOpen(Stream $stream): void
{
// Skip '<'
$stream->next();
$element = $stream->readTo('>');
- 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"