Showing 22 of 22 total issues
Function loadFromFile
has a Cognitive Complexity of 107 (exceeds 5 allowed). Consider refactoring. Confirmed
protected function loadFromFile(\ReflectionClass $class, string $path): ?ClassConfig
{
$previous = 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 toString
has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring. Confirmed
public function toString(ClassConfig $config): string
{
$xml = new \SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><serializer/>');
$classEl = $xml->addChild('class');
- 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 loadFromFile
has 185 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
protected function loadFromFile(\ReflectionClass $class, string $path): ?ClassConfig
{
$previous = libxml_use_internal_errors(true);
libxml_clear_errors();
Function fillProperty
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
private function fillProperty($propConf, array $annotations = [])
{
if (!$annotations) {
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 collectFolders
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
private function collectFolders(string $targetNamespace): array
{
$classLoader = $this->getClassLoader();
$targetNsArr = explode('\\', trim($targetNamespace, '\\'));
- 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 parseMethods
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
private function parseMethods(\ReflectionClass $class, ClassConfig $config): void
{
$callbacks = [
PreSerialize::class => 'preSerialize',
PostSerialize::class => 'postSerialize',
- 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 normalize
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function normalize(\ReflectionClass $class): ?ClassConfig
{
if ($class->isAbstract()) {
return null;
}
- 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 fillProperty
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function fillProperty($propConf, array $annotations = [])
{
if (!$annotations) {
return;
}
Method toString
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function toString(ClassConfig $config): string
{
$xml = new \SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><serializer/>');
$classEl = $xml->addChild('class');
Function addProperty
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private function addProperty(\SimpleXMLElement $classEl, string $nodeName, $config)
{
$propEl = $classEl->addChild($nodeName);
$properties = $this->extractClassPropertyTypes(new \ReflectionClass($config));
foreach ($properties as $propertyName => $type) {
- 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 normalize
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function normalize(\ReflectionClass $class): ?ClassConfig
{
if ($class->isAbstract()) {
return null;
}
Function collectClasses
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function collectClasses(string $namespace, string $folder): array
{
$result = [];
foreach (scandir($folder) as $item) {
if (\in_array($item, ['.', '..'])) {
- 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 collectFolders
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function collectFolders(string $targetNamespace): array
{
$classLoader = $this->getClassLoader();
$targetNsArr = explode('\\', trim($targetNamespace, '\\'));
Method addProperty
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function addProperty(\SimpleXMLElement $classEl, string $nodeName, $config)
{
$propEl = $classEl->addChild($nodeName);
$properties = $this->extractClassPropertyTypes(new \ReflectionClass($config));
foreach ($properties as $propertyName => $type) {
Method parseMethods
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function parseMethods(\ReflectionClass $class, ClassConfig $config): void
{
$callbacks = [
PreSerialize::class => 'preSerialize',
PostSerialize::class => 'postSerialize',
Function parseDiscriminator
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function parseDiscriminator(\SimpleXMLElement $elem)
{
$discriminator = new DiscriminatorConfig();
$discriminator->fieldName = (string) $elem->attributes()->{'discriminator-field-name'};
$discriminator->disabled = filter_var($elem->attributes()->{'discriminator-disabled'}, FILTER_VALIDATE_BOOLEAN);
- 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 toArray
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function toArray($configObject)
{
$reflection = new \ReflectionClass($configObject);
$result = [];
- 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 getClassLoader
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function getClassLoader(): ClassLoader
{
$folder = __DIR__;
while ($pathToComposer = $this->findComposerJson($folder)) {
$composerConfig = json_decode(file_get_contents($pathToComposer), 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"
Further reading
Function denormalize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function denormalize(ClassConfig $config)
{
if (!$this->namespaceFolders) {
throw new \LogicException('You must define at least one namespace folder');
}
- 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 listOf
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function listOf(string $class, $array)
{
if (!\is_array($array)) {
return null;
}
- 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"