brokencube/automatorm

View on GitHub

Showing 144 of 452 total issues

Avoid too many return statements within this method.
Open

                return 'NO_SUCH_SERVICE: Tried to access service "{$data}", but it has not yet been definied';
Severity: Major
Found in src/Exception/Model.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return false;
    Severity: Major
    Found in src/Orm/Data.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return 'MODEL_DATA:CANNOT_CALL_MULTIPIVOT_AS_PROPERTY: Property "'.$column.'" represents a M-M (Pivot) relationship with more than two keys. As we don\'t know which type of object to return (as there are multiple choices), you can\'t call this link as a simple property. Use the $model->property([\$where]) syntax instead.';
      Severity: Major
      Found in src/Exception/Model.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                            return 'MODEL_DATA:ARRAY_EXPECTED_FOR_PIVOT: Property "'.$column.'" represents a M-M (Pivot) relationship. It expects an array of Model objects, but you gave it a Model object. If you intended to replace all of the objects in this join with a single object, you should wrap your Model object in array first.';
        Severity: Major
        Found in src/Exception/Model.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return 'MODEL_DATA:UNEXPECTED_COLUMN_NAME: Property "'.$column.'" does not exist in the schema for this object ('.$model['table_name'].'). Please check the $model for this object, or look at $obj->var_dump()';
          Severity: Major
          Found in src/Exception/Model.php - About 30 mins to fix

            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

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

            The method __construct() has an NPath complexity of 11394. The configured NPath complexity threshold is 200.
            Open

                public function __construct($column)
                {
                    // Cowardly refuse to process SqlStrings
                    if ($column instanceof SqlString) {
                        $this->column = (string) $column;
            Severity: Minor
            Found in src/Database/QueryBuilder/Column.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

            The method generate() has 181 lines of code. Current threshold is set to 100. Avoid really long methods.
            Open

                public function generate()
                {
                    $connection = $this->connection;
                    
                    $model = [];

            The method generate() has an NPath complexity of 4752. The configured NPath complexity threshold is 200.
            Open

                public function generate()
                {
                    $connection = $this->connection;
                    
                    $model = [];

            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

            The method __construct() has an NPath complexity of 4500. The configured NPath complexity threshold is 200.
            Open

                public function __construct(Column $column, $affix, $value)
                {
                    $this->column = $column;
                    $this->comparitor = '=';
                    $this->value = $value;

            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

            The method generate() has an NPath complexity of 2550. The configured NPath complexity threshold is 200.
            Open

                public function generate()
                {
                    $data = $this->connection->data;
                    $database = $this->connection->schemaName;
                    

            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

            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

            The method generate() has 136 lines of code. Current threshold is set to 100. Avoid really long methods.
            Open

                public function generate()
                {
                    $data = $this->connection->data;
                    $database = $this->connection->schemaName;
                    
            Severity
            Category
            Status
            Source
            Language