ianaldrighetti/queryer

View on GitHub

Showing 19 of 33 total issues

Query has 29 functions (exceeds 20 allowed). Consider refactoring.
Open

class Query
{
    /**
     * The array containing all of the query options that have been added.
     *
Severity: Minor
Found in Queryer/Query.php - About 3 hrs to fix

    Method testBuildSelectQuery has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function testBuildSelectQuery()
        {
            $distinct = true;
            $expr = 'user_id, user_name, user_status';
            $table = 'users';
    Severity: Minor
    Found in QueryerTests/Query/SelectQueryTest.php - About 1 hr to fix

      Method testSelectQuery has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function testSelectQuery()
          {
              $query = Query::select();
      
              $options = array(
      Severity: Minor
      Found in QueryerTests/QueryTest.php - About 1 hr to fix

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

            public function execute($options)
            {
                // Save it for later!
                $this->executed[] = $options;
        
        
        Severity: Minor
        Found in Queryer/Mock/QueryMocker.php - About 1 hr to fix

          Method testInsertAndSelect has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function testInsertAndSelect()
              {
                  // The row of data (user_id is what we expect it's value to be, since it is AUTO INCREMENT).
                  $row = array(
                      'user_id' => 1,
          Severity: Minor
          Found in QueryerDbTests/Mysql/MysqlTest.php - About 1 hr to fix

            Method getInsertColumnNames has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static function getInsertColumnNames(array $rows)
                {
                    $rowCount = count($rows);
            
                    // We can't have 0 rows...
            Severity: Minor
            Found in Queryer/Engine/Mysql/MysqlDriver.php - About 1 hr to fix

              Method getInsertColumnNames has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static function getInsertColumnNames(array $rows)
                  {
                      $rowCount = count($rows);
              
                      // We can't have 0 rows...
              Severity: Minor
              Found in Queryer/Engine/Sqlite3/Sqlite3Driver.php - About 1 hr to fix

                Method testExecute has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function testExecute()
                    {
                        $query = Query::select()
                            ->expr('user_id')
                            ->from('users')
                Severity: Minor
                Found in QueryerTests/Engine/Mysql/MysqlDriverTest.php - About 1 hr to fix

                  Method testSetResult has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function testSetResult()
                      {
                          $resultSet = array(
                              array(
                                  'user_id' => 1,
                  Severity: Minor
                  Found in QueryerTests/Mock/QueryMockerTest.php - About 1 hr to fix

                    Method testUpdate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function testUpdate()
                        {
                            // Insert some fake data.
                            $this->insertFakeData(3);
                    
                    
                    Severity: Minor
                    Found in QueryerDbTests/Mysql/MysqlTest.php - About 1 hr to fix

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

                          public function __construct($type)
                          {
                              $type = strtoupper($type);
                      
                              // Make sure this is a type we know.
                      Severity: Minor
                      Found in Queryer/Query.php - About 1 hr to fix

                        Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public function __construct($result, $affectedRows, $insertId, $errorCode, $errorMessage, $query = null)
                        Severity: Minor
                        Found in Queryer/Engine/Mysql/MysqlDriverResult.php - About 45 mins to fix

                          Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                      $result,
                                      $affectedRows = 0,
                                      $insertId = 0,
                                      $errorCode = -1,
                                      $errorMessage = null,
                          Severity: Minor
                          Found in Queryer/Mock/QueryMockerResult.php - About 45 mins to fix

                            Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                public function __construct($result, $affectedRows, $insertId, $errorCode, $errorMessage, $query)
                            Severity: Minor
                            Found in Queryer/Engine/Sqlite3/Sqlite3DriverResult.php - About 45 mins to fix

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

                                  public function execute($options)
                                  {
                                      // Save it for later!
                                      $this->executed[] = $options;
                              
                              
                              Severity: Minor
                              Found in Queryer/Mock/QueryMocker.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 addResult has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  public function addResult($result, $affectedRows = 0, $insertId = 0, $errorCode = -1, $errorMessage = null)
                              Severity: Minor
                              Found in Queryer/Mock/QueryMocker.php - About 35 mins to fix

                                Method setResult has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    public function setResult($result, $affectedRows = 0, $insertId = 0, $errorCode = -1, $errorMessage = null)
                                Severity: Minor
                                Found in Queryer/Mock/QueryMocker.php - About 35 mins to fix

                                  Function generateQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public static function generateQuery($options)
                                      {
                                          $query = null;
                                  
                                          // Let's see what we got here.
                                  Severity: Minor
                                  Found in Queryer/Engine/Sqlite3/Sqlite3Driver.php - About 25 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 generateQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public static function generateQuery($options)
                                      {
                                          $query = null;
                                  
                                          // Let's see what we got here.
                                  Severity: Minor
                                  Found in Queryer/Engine/Mysql/MysqlDriver.php - About 25 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