Function convertDomElementToArray
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public function convertDomElementToArray(DOMElement $element, bool $checkPrefix = true)
{
$prefix = (string) $element->prefix;
$empty = true;
$config = [];
- 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 addBranch
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
protected function addBranch($branchName, array $config, XMLWriter $writer): void
{
$branchType = null;
foreach ($config as $key => $value) {
- 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
File XmlAdapter.php
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
/*
Function parse
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function parse(string $content, $schemaOrCallable = null): DOMDocument
{
$internalErrors = \libxml_use_internal_errors(true);
\libxml_clear_errors();
- 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 convertDomElementToArray
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function convertDomElementToArray(DOMElement $element, bool $checkPrefix = true)
{
$prefix = (string) $element->prefix;
$empty = true;
$config = [];
Method addBranch
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addBranch($branchName, array $config, XMLWriter $writer): void
{
$branchType = null;
foreach ($config as $key => $value) {
Method parse
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parse(string $content, $schemaOrCallable = null): DOMDocument
{
$internalErrors = \libxml_use_internal_errors(true);
\libxml_clear_errors();
Method phpize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function phpize($value)
{
$value = (string) $value;
$lowercaseValue = \strtolower($value);
Method dump
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function dump(array $data): string
{
$writer = new XMLWriter();
$writer->openMemory();
$writer->setIndent(true);
Avoid too many return
statements within this method. Open
return (string) $value;
Avoid too many return
statements within this method. Open
return (string) \bindec($value);
Avoid too many return
statements within this method. Open
return (string) (float) $value;
Avoid too many return
statements within this method. Open
return '0x' === $value[0] . $value[1] ? \hexdec($value) : (float) $value;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return \hexdec($value);
Avoid too many return
statements within this method. Open
return (float) $value;
Avoid too many return
statements within this method. Open
return $value;
Avoid too many return
statements within this method. Open
return \hexdec($value);
Avoid too many return
statements within this method. Open
return \bindec($value);
Function dump
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function dump(array $data): string
{
$writer = new XMLWriter();
$writer->openMemory();
$writer->setIndent(true);
- 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"