brokencube/automatorm

View on GitHub

Showing 452 of 452 total issues

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

                            $display4 = implode(',', $objstrings);
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 '$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 '$this' which will lead to PHP notices.
Open

            $output .= "  <span><strong>id</strong></span> => ".$this->id."\n";
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 '$this' which will lead to PHP notices.
Open

            foreach (get_object_vars($this) as $key => $value) {
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

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

      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

        The property $unix_socket is not named in camelCase.
        Open

        class Connection implements ConnectionInterface
        {
            use LoggerAwareTrait;
            public function getLogger()
            {
        Severity: Minor
        Found in src/DataLayer/Database/Connection.php by phpmd

        CamelCasePropertyName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name attributes.

        Example

        class ClassName {
            protected $property_name;
        }

        Source

        The property $_serviceContainer is not named in camelCase.
        Open

        class Schema
        {
            const CURRENT_VERSION = 9;
        
            // Singleton
        Severity: Minor
        Found in src/Orm/Schema.php by phpmd

        CamelCasePropertyName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name attributes.

        Example

        class ClassName {
            protected $property_name;
        }

        Source

        The parameter $previous_exception is not named in camelCase.
        Open

            public function __construct(Q $query, \Exception $previous_exception = null)
            {
                parent::__construct('Query error: '.$query->error, $query, $previous_exception);
            }
        Severity: Minor
        Found in src/Exception/Query.php by phpmd

        CamelCaseParameterName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name parameters.

        Example

        class ClassName {
            public function doSomething($user_name) {
            }
        }

        Source

        The property $id_limit is not named in camelCase.
        Open

        class Dump
        {
            public static $url_prefix = null;
            public static $id_limit = 30;
            
        Severity: Minor
        Found in src/Orm/Dump.php by phpmd

        CamelCasePropertyName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name attributes.

        Example

        class ClassName {
            protected $property_name;
        }

        Source

        The property $url_prefix is not named in camelCase.
        Open

        class Dump
        {
            public static $url_prefix = null;
            public static $id_limit = 30;
            
        Severity: Minor
        Found in src/Orm/Dump.php by phpmd

        CamelCasePropertyName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name attributes.

        Example

        class ClassName {
            protected $property_name;
        }

        Source

        The property $_data is not named in camelCase.
        Open

        class Model implements \JsonSerializable
        {
            // Flags
            const COUNT_ONLY = 1;
            
        Severity: Minor
        Found in src/Orm/Model.php by phpmd

        CamelCasePropertyName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name attributes.

        Example

        class ClassName {
            protected $property_name;
        }

        Source

        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/DataLayer/Database/DataAccess.php - About 45 mins 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

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

            Severity
            Category
            Status
            Source
            Language