edde-framework/edde-framework

View on GitHub

Showing 143 of 143 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php
    declare(strict_types=1);

    namespace Edde\Ext\Web;

Severity: Major
Found in src/Edde/Ext/Web/StyleSheetResourceProvider.php and 1 other location - About 1 day to fix
src/Edde/Ext/Web/JavaScriptResourceProvider.php on lines 1..59

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 357.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php
    declare(strict_types=1);

    namespace Edde\Ext\Web;

Severity: Major
Found in src/Edde/Ext/Web/JavaScriptResourceProvider.php and 1 other location - About 1 day to fix
src/Edde/Ext/Web/StyleSheetResourceProvider.php on lines 1..59

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 357.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function createFactoryList has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

        static public function createFactoryList(array $factoryList): array {
            $factories = [];
            foreach ($factoryList as $name => $factory) {
                $current = null;
                if ($factory instanceof \stdClass) {
Severity: Minor
Found in src/Edde/Ext/Container/ContainerFactory.php - About 7 hrs to fix

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        static public function charset(string $charset = null, $default = 'utf-8'): array {
            if ($charset === null) {
                return [$default];
            }
            foreach (explode(',', $charset) as $part) {
Severity: Major
Found in src/Edde/Common/Http/HttpUtils.php and 1 other location - About 7 hrs to fix
src/Edde/Common/Http/HttpUtils.php on lines 81..107

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 227.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        static public function language(string $language = null, string $default = 'en'): array {
            if ($language === null) {
                return [$default];
            }
            foreach (explode(',', $language) as $part) {
Severity: Major
Found in src/Edde/Common/Http/HttpUtils.php and 1 other location - About 7 hrs to fix
src/Edde/Common/Http/HttpUtils.php on lines 109..135

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 227.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function toNode has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

        static public function toNode(\stdClass $stdClass, INode $node = null, string $class = null): INode {
            $createNode = function (string $class, string $name = null): INode {
                /** @var $node INode */
                if (($node = new $class()) instanceof INode === false) {
                    throw new ClassMismatchException(sprintf('Class specified [%s] is not instance of [%s].', $class, INode::class));
Severity: Minor
Found in src/Edde/Common/Node/NodeUtils.php - About 6 hrs to fix

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 getArgumentList has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

        static public function getArgumentList(array $argv) {
            $argumentList = [];
            /** @noinspection ForeachInvariantsInspection */
            for ($i = 0, $j = count($argv); $i < $j; $i++) {
                $arg = $argv[$i];
Severity: Minor
Found in src/Edde/Common/Cli/CliUtils.php - About 5 hrs to fix

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 ContainerFactory.php has 364 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
    declare(strict_types=1);

    namespace Edde\Ext\Container;

Severity: Minor
Found in src/Edde/Ext/Container/ContainerFactory.php - About 4 hrs to fix

Function node has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

        static public function node(INode $root, $source): INode {
            $callback = null;
            if (is_array($source) === false && is_object($source) === false) {
                throw new NodeException('Source must be array or stdClass object.');
            }
Severity: Minor
Found in src/Edde/Common/Node/NodeUtils.php - About 4 hrs to fix

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 compile has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

        public function compile(IResourceList $resourceList = null): IFile {
            $content = [];
            $pathList = [];
            $resourceList = $resourceList ?: $this;
            $cache = $this->cache();
Severity: Minor
Found in src/Edde/Common/Web/StyleSheetCompiler.php - About 4 hrs to fix

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

AbstractStaticQueryFactory has 32 functions (exceeds 20 allowed). Consider refactoring.
Open

    abstract class AbstractStaticQueryFactory extends Object implements IStaticQueryFactory {
        use ConfigurableTrait;
        /**
         * @var array
         */
Severity: Minor
Found in src/Edde/Common/Query/AbstractStaticQueryFactory.php - About 4 hrs to fix

Function parseTag has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

        protected function parseTag(IIterator $iterator, IXmlHandler $xmlHandler) {
            $last = null;
            $name = '';
            $attributeList = [];
            $type = self::XML_TYPE_WARP;
Severity: Minor
Found in src/Edde/Common/Xml/XmlParser.php - About 3 hrs to fix

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 createHeaderList has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

        static public function createHeaderList(): IHeaderList {
            if (self::$headerList) {
                return self::$headerList;
            }
            $headers = [];
Severity: Minor
Found in src/Edde/Common/Http/HeaderList.php - About 3 hrs to fix

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 getDefaultFactoryList has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        static public function getDefaultFactoryList(): array {
            return [
                IContainer::class         => Container::class,
                IRootDirectory::class     => self::exception(sprintf('Root directory is not specified; please register [%s] interface.', IRootDirectory::class)),
                ITempDirectory::class     => self::proxy(IRootDirectory::class, 'directory', [
Severity: Major
Found in src/Edde/Ext/Container/ContainerFactory.php - About 3 hrs to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php
    declare(strict_types=1);

    namespace Edde\Common\Template\Macro;

Severity: Major
Found in src/Edde/Common/Template/Macro/LoadMacro.php and 1 other location - About 3 hrs to fix
src/Edde/Common/Template/Macro/IncludeMacro.php on lines 1..31

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 159.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php
    declare(strict_types=1);

    namespace Edde\Common\Template\Macro;

Severity: Major
Found in src/Edde/Common/Template/Macro/IncludeMacro.php and 1 other location - About 3 hrs to fix
src/Edde/Common/Template/Macro/LoadMacro.php on lines 1..31

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 159.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Url has 31 functions (exceeds 20 allowed). Consider refactoring.
Open

    class Url extends Object implements IUrl {
        /**
         * @var string
         */
        protected $scheme = '';
Severity: Minor
Found in src/Edde/Common/Url/Url.php - About 3 hrs to fix

Method execute has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function execute(): IResponse {
            if ($this->curl === null) {
                throw new ClientException(sprintf('Cannot execute handler for the url [%s] more than once.', (string)$this->request->getRequestUrl()));
            }
            $options = [];
Severity: Major
Found in src/Edde/Common/Http/Client/HttpHandler.php - About 3 hrs to fix

File has 29 functions (exceeds 20 allowed). Consider refactoring.
Open

    class File extends Resource implements IFile {
        /**
         * @var IDirectory
         */
        protected $directory;
Severity: Minor
Found in src/Edde/Common/File/File.php - About 3 hrs to fix

Function delete has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

        static public function delete($path) {
            for ($i = 0; $i < 3; $i++) {
                try {
                    if (is_file($path) || is_link($path)) {
                        $func = DIRECTORY_SEPARATOR === '\\' && is_dir($path) ? 'rmdir' : 'unlink';
Severity: Minor
Found in src/Edde/Common/File/FileUtils.php - About 3 hrs to fix

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

Severity
Category
Status
Source
Language