brokencube/automatorm

View on GitHub

Showing 144 of 452 total issues

File Data.php has 576 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace Automatorm\Orm;

use Automatorm\Exception;
use Automatorm\Database\SqlString;
Severity: Major
Found in src/Orm/Data.php - About 1 day to fix

    Function generate has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
    Open

        public function generate()
        {
            $data = $this->connection->data;
            $database = $this->connection->schemaName;
            
    Severity: Minor
    Found in src/DataLayer/Fake/SchemaGenerator.php - About 1 day 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 57 (exceeds 5 allowed). Consider refactoring.
    Open

        public function generate()
        {
            $connection = $this->connection;
            
            $model = [];
    Severity: Minor
    Found in src/DataLayer/Database/SchemaGenerator.php - About 1 day 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 filter has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        public function filter($filter, $invertAffix = false)
        {
            $copy = $this->container;
            
            if (is_array($filter)) {
    Severity: Minor
    Found in src/Orm/Collection.php - About 5 hrs 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 generateData has a Cognitive Complexity of 38 (exceeds 5 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 5 hrs 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 format has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function format($key, $value, $seen = [], $collectionCount = 0, $exceptionThrown = false)
        {
            switch (true) {
                case $value instanceof Model:
                    $namespace = explode('\\', get_class($value));
    Severity: Minor
    Found in src/Orm/Dump.php - About 5 hrs 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

    Data has 39 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Data
    {
        protected $data = [];           // Data from columns on this table
        protected $external = [];       // Links to foreign key objects
        
    Severity: Minor
    Found in src/Orm/Data.php - About 5 hrs to fix

      Method generate has 129 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function generate()
          {
              $connection = $this->connection;
              
              $model = [];
      Severity: Major
      Found in src/DataLayer/Database/SchemaGenerator.php - About 5 hrs to fix

        Method format has 113 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function format($key, $value, $seen = [], $collectionCount = 0, $exceptionThrown = false)
            {
                switch (true) {
                    case $value instanceof Model:
                        $namespace = explode('\\', get_class($value));
        Severity: Major
        Found in src/Orm/Dump.php - About 4 hrs to fix

          QueryBuilder has 35 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class QueryBuilder
          {
              const ENGINES = ['mysql', 'postgres', 'mssql'];
              public static $engine = "mysql";
              public static $requireWhereClause = true;
          Severity: Minor
          Found in src/Database/QueryBuilder.php - About 4 hrs to fix

            Function generate has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function generate($path, Schema $schema)
                {
                    $namespace = $schema->namespace;
                    
                    foreach ($schema->model as $model) {
            Severity: Minor
            Found in src/Generator/Model.php - About 4 hrs 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 28 (exceeds 5 allowed). Consider refactoring.
            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 - About 4 hrs 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

            Collection has 32 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Collection implements \ArrayAccess, \Iterator, \Countable, \JsonSerializable
            {
                // From Hodgepodge
                protected $container = [];
            
            
            Severity: Minor
            Found in src/Orm/Collection.php - About 4 hrs to fix

              Method generate has 99 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function generate()
                  {
                      $data = $this->connection->data;
                      $database = $this->connection->schemaName;
                      
              Severity: Major
              Found in src/DataLayer/Fake/SchemaGenerator.php - About 3 hrs to fix

                File QueryBuilder.php has 320 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * Query Builder - build SQL queries programatically
                 *
                 * @package Automatorm\Database
                Severity: Minor
                Found in src/Database/QueryBuilder.php - About 3 hrs to fix

                  Function __construct has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                  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 - About 3 hrs 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 dumpModel has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function dumpModel(Model $model)
                      {
                          $data_access = function ($var) {
                              return $this->$var;
                          };
                  Severity: Minor
                  Found in src/Orm/Dump.php - About 3 hrs 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 dumpModel has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function dumpModel(Model $model)
                      {
                          $data_access = function ($var) {
                              return $this->$var;
                          };
                  Severity: Major
                  Found in src/Orm/Dump.php - About 3 hrs to fix

                    Model has 28 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Model implements \JsonSerializable
                    {
                        // Flags
                        const COUNT_ONLY = 1;
                        
                    Severity: Minor
                    Found in src/Orm/Model.php - About 3 hrs to fix

                      Function factoryObjectCache has a Cognitive Complexity of 23 (exceeds 5 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 3 hrs 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

                      Severity
                      Category
                      Status
                      Source
                      Language