edde-framework/edde-framework

View on GitHub

Showing 127 of 143 total issues

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

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 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

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

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

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

StringUtils has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

    class StringUtils extends Object {
        private static $SEPARATOR_LIST = [
            '|',
            ':',
            '.',
Severity: Minor
Found in src/Edde/Common/Strings/StringUtils.php - About 3 hrs to fix

Crate has 27 functions (exceeds 20 allowed). Consider refactoring.
Open

    class Crate extends Object implements ICrate {
        /**
         * @var ISchema
         */
        protected $schema;
Severity: Minor
Found in src/Edde/Common/Crate/Crate.php - About 3 hrs to fix

AbstractNode has 27 functions (exceeds 20 allowed). Consider refactoring.
Open

    abstract class AbstractNode extends Object implements IAbstractNode {
        /**
         * @var IAbstractNode
         */
        protected $parent;
Severity: Minor
Found in src/Edde/Common/Node/AbstractNode.php - About 3 hrs to fix

Method parseTag has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

        public function node(INode $node, \Iterator $iterator, ...$parameters) {
            $level = $node->getLevel();
            $stack = new \SplStack();
            /**
             * @var $levelTreeTraversal ITreeTraversal
Severity: Minor
Found in src/Edde/Common/Node/AbstractTreeTraversal.php - About 2 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 parse has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

        protected function parse($query) {
            $query = str_replace('//', '/*/', $query);
            $query = '/' . trim($query, '/') . '/';
            $filter = new \stdClass();
            $filter->fixed = strpos($query, '**') === false && strpos($query, '?*') === false;
Severity: Minor
Found in src/Edde/Common/Node/NodeQuery.php - About 2 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