brokencube/automatorm

View on GitHub

Showing 452 of 452 total issues

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

    public function getData($table, $where, array $options = []) : array
    {
        // Select * from $table where $where
        $query = QueryBuilder::select($table)->where($where);
        
Severity: Minor
Found in src/DataLayer/Database/DataAccess.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

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

    public function joinCount($var, $where = [])
    {
        if (!is_null($this->external[$var]) && !$this->external[$var] instanceof Collection) {
            return 1;
        }
Severity: Minor
Found in src/Orm/Data.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

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

    public function render(QueryBuilder $query) : string
    {
        // Special case for tautological or contractdictory expressions (true / false)
        if (!$this->column) {
            return $this->comparitor;
Severity: Minor
Found in src/Database/QueryBuilder/Expression.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 commit has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function commit($mode, $table, $id, $data, $externalData, $schema) : int
Severity: Minor
Found in src/DataLayer/Fake/DataAccess.php - About 45 mins to fix

    Method factory has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        final public static function factory($where, $classOrTablename = null, $schema = null, array $options = [], $singleResult = false)
    Severity: Minor
    Found in src/Orm/Model.php - About 35 mins to fix

      Method format has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static function format($key, $value, $seen = [], $collectionCount = 0, $exceptionThrown = false)
      Severity: Minor
      Found in src/Orm/Dump.php - About 35 mins to fix

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

            public function execute()
            {
                $pdo = $this->connection->connect();
                
                // We are only allowed to execute each Query object once!
        Severity: Minor
        Found in src/Database/Query.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 duplicate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function duplicate($cloneExternalProps = false, Model $newParent = null)
            {
                $clone = clone $this;
                $clone->new = true;
                $clone->delete = false;
        Severity: Minor
        Found in src/Orm/Data.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 __set has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function __set($var, $value)
            {
                // Cannot change data if it is locked (i.e. it is attached to a Model object)
                if ($this->locked) {
                    throw new Exception\Model('MODEL_DATA:SET_WHEN_LOCKED', array($var, $value));
        Severity: Minor
        Found in src/Orm/Data.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 guessContext has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function guessContext($classOrTable)
            {
                // Return 'cached' result
                if (isset(static::$contextCache[$classOrTable])) {
                    return static::$contextCache[$classOrTable];
        Severity: Minor
        Found in src/Orm/Schema.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 addOnClauses has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function addOnClauses($clauses)
            {
                foreach ($clauses as $key => $value) {
                    if ($value instanceof QueryBuilder) {
                        $value = new InnerQuery($value);
        Severity: Minor
        Found in src/Database/QueryBuilder/Where.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 addClauses has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function addClauses($clauses)
            {
                foreach ($clauses as $key => $value) {
                    if ($value instanceof QueryBuilder) {
                        $value = new InnerQuery($value);
        Severity: Minor
        Found in src/Database/QueryBuilder/Where.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 makeMessage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            private function makeMessage($code, $data)
            {
                switch ($code) {
                    case 'NO_GENERATED_SCHEMA':
                        return 'NO_GENERATED_SCHEMA: Could not find a schema definition for namespace: ' . $data;
        Severity: Minor
        Found in src/Exception/Model.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

        The closing brace for the interface must go on the next line after the body
        Open

        }

        Each PHP statement must be on a line by itself
        Open

                    return Data::groupJoin($this->map(function ($a) { return $a->getModel(); }), $parameter);
        Severity: Minor
        Found in src/Orm/Collection.php by phpcodesniffer

        Expected 0 spaces before opening brace; 1 found
        Open

        {

        There must be one USE keyword per declaration
        Open

        use Automatorm\Database\QueryBuilder\{

        Property name "$_data" should not be prefixed with an underscore to indicate visibility
        Open

            protected $_data;             // Container for the Model_Data object for this row. Used for both internal and external __get access.
        Severity: Minor
        Found in src/Orm/Model.php by phpcodesniffer

        Method name "_init" should not be prefixed with an underscore to indicate visibility
        Open

            protected function _init()
        Severity: Minor
        Found in src/Orm/Model.php by phpcodesniffer

        Property name "$_serviceContainer" should not be prefixed with an underscore to indicate visibility
        Open

            protected $_serviceContainer = [];
        Severity: Minor
        Found in src/Orm/Schema.php by phpcodesniffer
        Severity
        Category
        Status
        Source
        Language