edde-framework/edde-framework

View on GitHub

Showing 143 of 143 total issues

Method inline has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function inline(IMacro $source, ICompiler $compiler, \Iterator $iterator, INode $node, string $name, $value = null) {
            switch ($name) {
                case'switch':
                    $source->on(self::EVENT_PRE_ENTER, function () use ($value) {
                        $this->macroOpenSwitch($this->delimite($value));
Severity: Minor
Found in src/Edde/Common/Template/Macro/SwitchMacro.php - About 1 hr to fix

Function parseComment has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        protected function parseComment(IIterator $iterator) {
            $type = self::XML_TYPE_COMMENT;
            $close = false;
            foreach ($iterator as $char) {
                switch ($char) {
Severity: Minor
Found in src/Edde/Common/Xml/XmlParser.php - About 55 mins 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 isDirty has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        public function isDirty($current, $value): bool {
            if ($current === null && $value === null) {
                return false;
            } else if (($current === null && $value !== null) || ($current !== null && $value === null)) {
                return true;
Severity: Minor
Found in src/Edde/Common/Schema/Property.php - About 55 mins 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 template has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        public function template($context = null, string $name = null) {
            try {
                /** @var $context ITemplateContext */
                if ($context === 'this') {
                    $context = $this;
Severity: Minor
Found in src/Edde/Ext/Template/TemplateTrait.php - About 55 mins 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 store has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        public function store(ICrate $crate): IStorage {
            $this->driver->setup();
            $schema = $crate->getSchema();
            if ($schema->getMeta('storable', false) === false) {
                throw new StorageException(sprintf('Crate [%s] is not marked as storable (in meta data).', $schema->getSchemaName()));
Severity: Minor
Found in src/Edde/Common/Database/DatabaseStorage.php - About 55 mins 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 can has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        public function can(string $resource, \DateTime $dateTime = null, bool $default = null): bool {
            if ($default === null && isset($this->aclList[$resource]) === false && isset($this->aclList[null]) === false) {
                throw new AclException(sprintf('Asking for unknown resource [%s].', $resource));
            }
            $can = (bool)$default;
Severity: Minor
Found in src/Edde/Common/Acl/Acl.php - About 55 mins 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 getPath has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        public function getPath($attribute = false, $meta = false) {
            $current = $this;
            $path = [];
            while ($current) {
                $fragment = $current->getName();
Severity: Minor
Found in src/Edde/Common/Node/Node.php - About 55 mins 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 getParameterList has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        protected function getParameterList(\ReflectionClass $reflectionClass, \ReflectionMethod $reflectionMethod, string $method) {
            $parameterList = [];
            if (strlen($name = $reflectionMethod->getName()) > strlen($method) && strpos($name, $method, 0) === 0) {
                if ($reflectionMethod->isPublic() === false) {
                    throw new ContainerException(sprintf('Method [%s::%s()] must be public.', $reflectionClass->getName(), $reflectionMethod->getName()));
Severity: Minor
Found in src/Edde/Common/Container/Factory/ClassFactory.php - About 55 mins 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 formatCreateSchemaQuery has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        protected function formatCreateSchemaQuery(INode $node) {
            $sql = 'CREATE TABLE IF NOT EXISTS ' . $this->delimite($node->getValue()) . ' (';
            $columnList = [];
            foreach ($this->createSchemaNodeQuery->filter($node) as $propertyNode) {
                $column = $this->delimite($propertyNode->getName()) . ' ' . $this->type($propertyNode->getAttribute('type'));
Severity: Minor
Found in src/Edde/Common/Query/AbstractStaticQueryFactory.php - About 55 mins 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 __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        public function __construct(ISchema $schema, string $name, string $type = 'string', bool $required = true, bool $unique = false, bool $identifier = false, bool $array = false) {
Severity: Major
Found in src/Edde/Common/Schema/Property.php - About 50 mins to fix

Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        public function __construct($name, $value, $expire, $path, $domain, $secure = false, $httpOnly = false) {
Severity: Major
Found in src/Edde/Common/Http/Cookie.php - About 50 mins to fix

Method inline has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        public function inline(IMacro $source, ICompiler $compiler, \Iterator $iterator, INode $node, string $name, $value = null) {
Severity: Minor
Found in src/Edde/Common/Template/Macro/IncludeMacro.php - About 45 mins to fix

Method inline has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        public function inline(IMacro $source, ICompiler $compiler, \Iterator $iterator, INode $node, string $name, $value = null) {
Severity: Minor
Found in src/Edde/Common/Template/Macro/TemplateMacro.php - About 45 mins to fix

Function getAbsoluteUrl has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        public function getAbsoluteUrl(): string {
            $scheme = $this->getScheme();
            $url = '';
            if ($scheme !== '') {
                $url = $scheme . '://';
Severity: Minor
Found in src/Edde/Common/Url/Url.php - About 45 mins 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 inline has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        public function inline(IMacro $source, ICompiler $compiler, \Iterator $iterator, INode $node, string $name, $value = null) {
Severity: Minor
Found in src/Edde/Common/Template/Macro/LoadMacro.php - About 45 mins to fix

Method inline has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        public function inline(IMacro $source, ICompiler $compiler, \Iterator $iterator, INode $node, string $name, $value = null) {
Severity: Minor
Found in src/Edde/Common/Template/AbstractMacro.php - About 45 mins to fix

Function read has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        public function read(callable $handler = null): string {
            /**
             * stream must read the data or connection will stay forever
             */
            $data = '';
Severity: Minor
Found in src/Edde/Common/Stream/Connection.php - About 45 mins 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 inline has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        public function inline(IMacro $source, ICompiler $compiler, \Iterator $iterator, INode $node, string $name, $value = null) {
Severity: Minor
Found in src/Edde/Common/Template/Macro/ForeachMacro.php - About 45 mins to fix

Method inline has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        public function inline(IMacro $source, ICompiler $compiler, \Iterator $iterator, INode $node, string $name, $value = null) {
Severity: Minor
Found in src/Edde/Common/Template/Macro/IfMacro.php - About 45 mins to fix

Function copyDirectory has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        static public function copyDirectory(string $source, string $destination, callable $filter = null) {
            $source = self::normalize($source);
            $destination = self::normalize($destination);
            /** @var $item \SplFileInfo */
            foreach (new \RecursiveIteratorIterator($iterator = new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
Severity: Minor
Found in src/Edde/Common/File/FileUtils.php - About 45 mins 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