Showing 44 of 44 total issues
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 Container.php
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
/*
Function getParameter
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function getParameter(string $name)
{
if (!\array_key_exists($name, $this->parameters)) {
$alternatives = [];
- 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 autowireArgument
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private static function autowireArgument(ReflectionParameter $parameter, callable $getter)
{
$type = Reflection::getParameterType($parameter);
$method = $parameter->getDeclaringFunction();
$desc = Reflection::toString($parameter);
- 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
Container
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Container extends NetteContainer implements FactoryInterface
{
/** @var object[] service name => instance */
private $instances = [];
Consider simplifying this complex logical expression. Open
if ($type && !Reflection::isBuiltinType($type)) {
try {
$res = $getter($type, true);
} catch (MissingServiceException $e) {
$res = null;
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
Function createInstance
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function createInstance(string $class, array $args = [])
{
try {
$reflector = new \ReflectionClass($class);
} catch (\ReflectionException $e) {
- 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) {
Function arrayGet
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function arrayGet($array, $key, $default = null)
{
if (!\is_array($array) && !$array instanceof ArrayAccess) {
throw new InvalidArgumentException('First parameter must be an array or ArrayAccess object.');
}
- 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 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 autowireArgument
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function autowireArgument(ReflectionParameter $parameter, callable $getter)
{
$type = Reflection::getParameterType($parameter);
$method = $parameter->getDeclaringFunction();
$desc = Reflection::toString($parameter);
Function getByType
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getByType(string $type, bool $throw = true)
{
$type = Helpers::normalizeClass($type);
if (!empty($this->wiring[$type][0])) {
- 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 getByType
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getByType(string $type, bool $throw = true)
{
$type = Helpers::normalizeClass($type);
if (!empty($this->wiring[$type][0])) {
Method arrayGet
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function arrayGet($array, $key, $default = null)
{
if (!\is_array($array) && !$array instanceof ArrayAccess) {
throw new InvalidArgumentException('First parameter must be an array or ArrayAccess object.');
}
Method getParameter
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getParameter(string $name)
{
if (!\array_key_exists($name, $this->parameters)) {
$alternatives = [];
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);