brokencube/automatorm

View on GitHub

Showing 144 of 452 total issues

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

      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

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

                Function dataClearCache has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    final public function dataClearCache()
                    {
                        $modelschema = $this->_data->getModel();
                        
                        // Clean out cached column data
                Severity: Minor
                Found in src/Orm/Model.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 __get has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function &__get($var)
                    {
                        /* This property is a native database column, return it */
                        if (isset($this->data[$var])) {
                            return $this->data[$var];
                Severity: Minor
                Found in src/Orm/Data.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 __call has 26 lines of code (exceeds 25 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

                  Method generateForeignKeys has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function generateForeignKeys(Data $datastore)
                      {
                          $data = $datastore->data;
                          $tableName = null;
                          $keys = [];
                  Severity: Minor
                  Found in src/DataLayer/Fake/SchemaGenerator.php - About 1 hr to fix

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

                        public function join($var, array $where = [])
                        {
                            if (array_key_exists($var, $this->external)) {
                                if ($this->external[$var] instanceof Collection) {
                                    return $this->external[$var]->filter($where);
                    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 generate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function generate(Connection $connection, $namespace = 'models', $cache = null) : Schema
                        {
                            // Get schema from cache
                            if (is_null($cache)) {
                                list($model, $schema) = $connection->getSchemaGenerator()->generate();
                    Severity: Minor
                    Found in src/Orm/Schema.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/Interfaces/DataAccess.php - About 45 mins to fix

                      Function extractAffix has a Cognitive Complexity of 8 (exceeds 5 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 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/Database/DataAccess.php - About 45 mins to fix

                        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
                          Severity
                          Category
                          Status
                          Source
                          Language