edde-framework/edde-framework

View on GitHub
src/Edde/Common/Crate/Crate.php

Summary

Maintainability
B
5 hrs
Test Coverage

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

Function push has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        public function push(array $push, bool $strict = true): ICrate {
            if ($strict && ($diff = array_diff(array_keys($push), array_keys($this->propertyList))) !== []) {
                throw new CrateException(sprintf('Setting unknown values [%s] to the crate [%s].', implode(', ', $diff), $this->schema->getSchemaName()));
            }
            foreach ($push as $property => $value) {
Severity: Minor
Found in src/Edde/Common/Crate/Crate.php - About 35 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 put has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        public function put(array $put, bool $strict = true): ICrate {
            if ($strict && ($diff = array_diff(array_keys($put), array_keys($this->propertyList))) !== []) {
                throw new CrateException(sprintf('Setting unknown values [%s] to the crate [%s].', implode(', ', $diff), $this->schema->getSchemaName()));
            }
            foreach ($put as $property => $value) {
Severity: Minor
Found in src/Edde/Common/Crate/Crate.php - About 25 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 getIdentifierList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        public function getIdentifierList(): array {
            if ($this->identifierList === null) {
                $this->identifierList = [];
                foreach ($this->propertyList as $property) {
                    if ($property->getSchemaProperty()->isIdentifier()) {
Severity: Minor
Found in src/Edde/Common/Crate/Crate.php - About 25 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 commit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        public function commit(callable $callback = null): ICrate {
            if ($callback === null && $this->commit === null) {
                throw new CryptException(sprintf('Commit is not available on crate [%s]. It has to be set before calling.', $this->schema->getSchemaName()));
            }
            if ($callback === null) {
Severity: Minor
Found in src/Edde/Common/Crate/Crate.php - About 25 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

There are no issues that match your filters.

Category
Status