brokencube/automatorm

View on GitHub

Showing 452 of 452 total issues

Missing class import via use statement (line '433', column '23').
Open

            throw new \InvalidArgumentException('Orm\Collection->filter() expects an array or callable');
Severity: Minor
Found in src/Orm/Collection.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '48', column '41').
Open

                $this->data[$key] = new \DateTimeImmutable($value, new \DateTimeZone('UTC'));
Severity: Minor
Found in src/Orm/Data.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '48', column '72').
Open

                $this->data[$key] = new \DateTimeImmutable($value, new \DateTimeZone('UTC'));
Severity: Minor
Found in src/Orm/Data.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '314', column '23').
Open

            throw new \BadMethodCallException("Method does not exist ({$var})", 0, $e);
Severity: Minor
Found in src/Orm/Model.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '581', column '24').
Open

            return new \DateTimeImmutable('@' . $value, new \DateTimeZone('UTC'));
Severity: Minor
Found in src/Orm/Data.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '63', column '27').
Open

                throw new \InvalidArgumentException('Supplied $cache does not implement PSR6/16 interface');
Severity: Minor
Found in src/Orm/Schema.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '38', column '23').
Open

            throw new \UnexpectedValueException('Unknown property');
Severity: Minor
Found in src/Database/QueryBuilder.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '51', column '34').
Open

            $item->expiresAt(new \DateTime('now + 3600 seconds'));
Severity: Minor
Found in src/Orm/Schema.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '583', column '24').
Open

            return new \DateTimeImmutable('@' . $datetime, new \DateTimeZone('UTC'));
Severity: Minor
Found in src/Orm/Data.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '336', column '27').
Open

                throw new \InvalidArgumentException("Orm\Collection->add() expects argument {$count} to be an array");
Severity: Minor
Found in src/Orm/Collection.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Function setManyToManyData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function setManyToManyData($var, $value)
    {
        $this->updateExternal[$var] = true;
        
        if (is_null($value)) {
Severity: Minor
Found in src/Orm/Data.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()
    {
        // Determine the type of SQL instruction to run
        if ($this->delete) {
            $mode = 'delete';
Severity: Minor
Found in src/Orm/Data.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 groupJoinM2M has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function groupJoinM2M(Collection $collection, $var, $where, $countOnly = false)
    {
        $results = new Collection();
        $proto = $collection[0]->_data;

Severity: Minor
Found in src/Orm/Data.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 __isset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function __isset($var)
    {
        // Is it already set in local array?
        if (array_key_exists($var, $this->data)) {
            return true;
Severity: Minor
Found in src/Orm/Data.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 __get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function __get($parameter)
    {
        $list = array();
        
        if ($this->container[0] instanceof Model and $this->container[0]->_data->externalKeyExists($parameter)) {
Severity: Minor
Found in src/Orm/Collection.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 groupJoin12M has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function groupJoin12M(Collection $collection, $var, $where, $countOnly = false)
    {
        $proto = $collection[0]->_data;

        $table = $proto->model['one-to-many'][$var]['table'];
Severity: Minor
Found in src/Orm/Data.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 factory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    final public static function factory($where, $classOrTablename = null, $schema = null, array $options = [], $singleResult = false)
    {
        // Figure out the base class and table we need based on current context
        $schema = $schema ?: Schema::get(static::getNamespace());
        list($class, $table) = $schema->guessContext($classOrTablename ?: get_called_class());
Severity: Minor
Found in src/Orm/Model.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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function __construct($details, array $options = [], LoggerInterface $logger = null)
    {
        $this->schemaGenerator = new SchemaGenerator($this);
        $this->dataAccess = new DataAccess($this);
        $this->logger = $logger;
Severity: Minor
Found in src/DataLayer/Database/Connection.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

The method commit() has an NPath complexity of 800. The configured NPath complexity threshold is 200.
Open

    public function commit($mode, $table, $id, $data, $externalData, $schema) : int
    {
        if ($mode == 'delete') {
            $this->data->delete($table, $id);
            return $id;
Severity: Minor
Found in src/DataLayer/Fake/DataAccess.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

Avoid unused parameters such as '$options'.
Open

    public function getDataCount($table, $where, array $options = []) : int
Severity: Minor
Found in src/DataLayer/Fake/DataAccess.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Severity
Category
Status
Source
Language