brokencube/automatorm

View on GitHub

Showing 452 of 452 total issues

Method extractAffix has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function extractAffix($propertyName, $invert = false)
    {
        $parts = [];
        // Look for special non-alphanumeric affixes
        preg_match('/^([!=<>%#]*)([^!=<>%#]+)([!=<>%#]*)$/', $propertyName, $parts);
Severity: Minor
Found in src/OperatorParser.php - About 1 hr to fix

    Function __call has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __call($name, $args)
        {
            // If we use Model::COUNT_ONLY on empty container, return 0
            if (count($this->container) == 0 && is_numeric($args[1]) && ($args[1] & Model::COUNT_ONLY)) {
                return 0;
    Severity: Minor
    Found in src/Orm/Collection.php - About 1 hr 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 unique has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        public function unique()
        {
            $copy = $this->container;
            $clobberlist = [];
            $modelclobberlist = [];
    Severity: Minor
    Found in src/Orm/Collection.php - About 1 hr 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 generateTableList has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function generateTableList(Data $datastore)
        {
            $data = $datastore->data;
            foreach(preg_split('~[\r\n]+~', $data) as $line) {
                if (empty($line) or ctype_space($line)) {
    Severity: Minor
    Found in src/DataLayer/Fake/SchemaGenerator.php - About 1 hr to fix

      Method generateData has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function generateData($connection)
          {
              list($schema, $database) = $connection->getSchemaGenerator()->generate();
              
              $currentTable = null;
      Severity: Minor
      Found in src/DataLayer/Fake/Data.php - About 1 hr to fix

        Method groupJoinM2M has 34 lines of code (exceeds 25 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 1 hr to fix

          Avoid using short method names like Join::on(). The configured minimum method name length is 3.
          Open

              public function on(array $clauses) : self
              {
                  $this->where->addOnClauses($clauses);
                  return $this;
              }
          Severity: Minor
          Found in src/Database/QueryBuilder/Join.php by phpmd

          ShortMethodName

          Since: 0.2

          Detects when very short method names are used.

          Example

          class ShortMethod {
              public function a( $index ) { // Violation
              }
          }

          Source https://phpmd.org/rules/naming.html#shortmethodname

          Method commit has 33 lines of code (exceeds 25 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 1 hr to fix

            Method resolve has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function resolve() : array
                {
                    $this->data = [];
                    
                    $table = $this->table->render($this);
            Severity: Minor
            Found in src/Database/QueryBuilder.php - About 1 hr to fix

              Method factoryObjectCache has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  final public static function factoryObjectCache($ids, $classOrTable = null, Schema $schema = null, $forceRefresh = false)
                  {
                      $schema = $schema ?: Schema::get(static::getNamespace());
                      list(,$table) = $schema->guessContext($classOrTable ?: get_called_class());
                      $namespace = $schema->namespace;
              Severity: Minor
              Found in src/Orm/Model.php - About 1 hr to fix

                Method getFullTree has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getFullTree()
                    {
                        $table = $this->closureTable;
                
                        // Find the root node from the supplied node_id
                Severity: Minor
                Found in src/Orm/Traits/ClosureTree.php - About 1 hr to fix

                  Avoid using undefined variables such as '$clauses' which will lead to PHP notices.
                  Open

                                  $clauses['`pivotjoin`.`' . $clauseColumn . '`' . $prefix] = $clauseValue;
                  Severity: Minor
                  Found in src/DataLayer/Database/DataAccess.php by phpmd

                  UndefinedVariable

                  Since: 2.8.0

                  Detects when a variable is used that has not been defined before.

                  Example

                  class Foo
                  {
                      private function bar()
                      {
                          // $message is undefined
                          echo $message;
                      }
                  }

                  Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                  Avoid using undefined variables such as '$clauses' which will lead to PHP notices.
                  Open

                              $query->where($clauses);
                  Severity: Minor
                  Found in src/DataLayer/Database/DataAccess.php by phpmd

                  UndefinedVariable

                  Since: 2.8.0

                  Detects when a variable is used that has not been defined before.

                  Example

                  class Foo
                  {
                      private function bar()
                      {
                          // $message is undefined
                          echo $message;
                      }
                  }

                  Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                  Avoid using undefined variables such as '$return' which will lead to PHP notices.
                  Open

                              $return[] = [
                  Severity: Minor
                  Found in src/DataLayer/Fake/DataAccess.php by phpmd

                  UndefinedVariable

                  Since: 2.8.0

                  Detects when a variable is used that has not been defined before.

                  Example

                  class Foo
                  {
                      private function bar()
                      {
                          // $message is undefined
                          echo $message;
                      }
                  }

                  Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                  Avoid using undefined variables such as '$clauses' which will lead to PHP notices.
                  Open

                          if ($clauses) {
                  Severity: Minor
                  Found in src/DataLayer/Database/DataAccess.php by phpmd

                  UndefinedVariable

                  Since: 2.8.0

                  Detects when a variable is used that has not been defined before.

                  Example

                  class Foo
                  {
                      private function bar()
                      {
                          // $message is undefined
                          echo $message;
                      }
                  }

                  Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                  Avoid using undefined variables such as '$return' which will lead to PHP notices.
                  Open

                          return $return;
                  Severity: Minor
                  Found in src/DataLayer/Fake/DataAccess.php by phpmd

                  UndefinedVariable

                  Since: 2.8.0

                  Detects when a variable is used that has not been defined before.

                  Example

                  class Foo
                  {
                      private function bar()
                      {
                          // $message is undefined
                          echo $message;
                      }
                  }

                  Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                  Avoid using undefined variables such as '$this' which will lead to PHP notices.
                  Open

                              $data = $data_access->bindTo($this->_data, $this->_data);
                  Severity: Minor
                  Found in src/Orm/Dump.php by phpmd

                  UndefinedVariable

                  Since: 2.8.0

                  Detects when a variable is used that has not been defined before.

                  Example

                  class Foo
                  {
                      private function bar()
                      {
                          // $message is undefined
                          echo $message;
                      }
                  }

                  Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                  Avoid using undefined variables such as '$objstrings' which will lead to PHP notices.
                  Open

                                                  $objstrings[] = \Automatorm\Orm\Dump::safeTruncate($obj);
                  Severity: Minor
                  Found in src/Orm/Dump.php by phpmd

                  UndefinedVariable

                  Since: 2.8.0

                  Detects when a variable is used that has not been defined before.

                  Example

                  class Foo
                  {
                      private function bar()
                      {
                          // $message is undefined
                          echo $message;
                      }
                  }

                  Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                  Avoid using undefined variables such as '$instance' which will lead to PHP notices.
                  Open

                                  Model::$instance[$namespace][$table][$row['id']] = $obj;
                  Severity: Minor
                  Found in src/Orm/Model.php by phpmd

                  UndefinedVariable

                  Since: 2.8.0

                  Detects when a variable is used that has not been defined before.

                  Example

                  class Foo
                  {
                      private function bar()
                      {
                          // $message is undefined
                          echo $message;
                      }
                  }

                  Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                  Avoid using undefined variables such as '$instance' which will lead to PHP notices.
                  Open

                              if (!$obj = isset(Model::$instance[$namespace][$table][$row['id']]) ? Model::$instance[$namespace][$table][$row['id']] : false) {
                  Severity: Minor
                  Found in src/Orm/Model.php by phpmd

                  UndefinedVariable

                  Since: 2.8.0

                  Detects when a variable is used that has not been defined before.

                  Example

                  class Foo
                  {
                      private function bar()
                      {
                          // $message is undefined
                          echo $message;
                      }
                  }

                  Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                  Severity
                  Category
                  Status
                  Source
                  Language