YetiForceCompany/YetiForceCRM

View on GitHub
app/Db/Command.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

@throws type of query has undeclared type \App\Db\Exception (Did you mean class \Exception)
Open

    public function query()
Severity: Minor
Found in app/Db/Command.php by phan

Class extends undeclared class \yii\db\Command (Did you mean class \App\Db\Command)
Open

class Command extends \yii\db\Command
Severity: Critical
Found in app/Db/Command.php by phan

@throws type of queryAllByGroup has undeclared type \App\Db\Exception (Did you mean class \Exception)
Open

    public function queryAllByGroup(int $type = 0)
Severity: Minor
Found in app/Db/Command.php by phan

Call to undeclared method \App\Db\Command::queryInternal
Open

                return $this->queryInternal('fetchAll', \PDO::FETCH_GROUP | \PDO::FETCH_UNIQUE | \PDO::FETCH_ASSOC);
Severity: Critical
Found in app/Db/Command.php by phan

Call to undeclared method \App\Db\Command::queryInternal
Open

                return $this->queryInternal('fetchAll', \PDO::FETCH_KEY_PAIR);
Severity: Critical
Found in app/Db/Command.php by phan

Return type of query() is undeclared type \yii\db\DataReader
Open

    public function query()
Severity: Minor
Found in app/Db/Command.php by phan

Call to undeclared method \App\Db\Command::queryInternal
Open

        return $this->queryInternal('');
Severity: Critical
Found in app/Db/Command.php by phan

Call to undeclared method \App\Db\Command::queryInternal
Open

                return $this->queryInternal('fetchAll', \PDO::FETCH_GROUP | \PDO::FETCH_COLUMN | \PDO::FETCH_ASSOC);
Severity: Critical
Found in app/Db/Command.php by phan

Define a constant instead of duplicating this literal "fetchAll" 3 times.
Open

                return $this->queryInternal('fetchAll', \PDO::FETCH_KEY_PAIR);
Severity: Critical
Found in app/Db/Command.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Spaces must be used to indent lines; tabs are not allowed
Open

    public function queryAllByGroup(int $type = 0)
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @throws Exception execution failed
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return array all rows of the query result. Each array element is an array representing a row of data.
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * This method is for executing a SQL query that returns result set, such as `SELECT`.
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return \yii\db\DataReader the reader object for fetching the query result
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return $this->queryInternal('');
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        switch ($type) {
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                return $this->queryInternal('fetchAll', \PDO::FETCH_KEY_PAIR);
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param int $type - fetchMode the result fetch mode. Please refer to [PHP manual](https://secure.php.net/manual/en/function.PDOStatement-setFetchMode.php))
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                return $this->queryInternal('fetchAll', \PDO::FETCH_GROUP | \PDO::FETCH_UNIQUE | \PDO::FETCH_ASSOC);
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            default:
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function query()
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *                  for valid fetch modes. If this parameter is null, the value set in [[fetchMode]] will be used
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                break;
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Executes the SQL statement and returns ALL rows at once.
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            case 0:
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Executes the SQL statement and returns query result.
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            case 2:
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                return $this->queryInternal('fetchAll', \PDO::FETCH_GROUP | \PDO::FETCH_COLUMN | \PDO::FETCH_ASSOC);
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            case 1:
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *               An empty array is returned if the query results in nothing
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Line exceeds 120 characters; contains 161 characters
Open

     * @param int $type - fetchMode the result fetch mode. Please refer to [PHP manual](https://secure.php.net/manual/en/function.PDOStatement-setFetchMode.php))
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @throws Exception execution failed
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Db/Command.php by phpcodesniffer

There are no issues that match your filters.

Category
Status