elcodedocle/gplusraffle

View on GitHub
AdminDAO.php

Summary

Maintainability
D
2 days
Test Coverage

File AdminDAO.php has 286 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * gplusraffle - Google API PHP OAuth 2.0 and FusionTables client based raffle 
 * management system
 * 
Severity: Minor
Found in AdminDAO.php - About 2 hrs to fix

    Function setClient has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        public function setClient(
            $accessToken = null, 
            $client_id = null, 
            $client_secret = null, 
            $redirect_uri = null, 
    Severity: Minor
    Found in AdminDAO.php - About 2 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 __construct has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __construct(
            $client_id = null,
            $client_secret = null,
            $redirect_uri = null,
            $adminId = null, 
    Severity: Minor
    Found in AdminDAO.php - About 1 hr to fix

      Function readAdminSettings has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          public function readAdminSettings($fileName = null){
              if ($fileName === null) { $fileName = $this->fileName; }
              if (file_exists($fileName)){
                  require $fileName;
                  if (!isset($settings)||!is_array($settings)){
      Severity: Minor
      Found in AdminDAO.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 saveAdminSettings has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function saveAdminSettings(
              $adminId = null, 
              $adminToken = null, 
              $tableIds = null, 
              $fileName = null
      Severity: Minor
      Found in AdminDAO.php - About 1 hr to fix

        Method createTables has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function createTables(
                $client = null,
                $tableSchema = null,
                $debug = null
            ){
        Severity: Minor
        Found in AdminDAO.php - About 1 hr to fix

          Function saveAdminSettings has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              public function saveAdminSettings(
                  $adminId = null, 
                  $adminToken = null, 
                  $tableIds = null, 
                  $fileName = null
          Severity: Minor
          Found in AdminDAO.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 __construct has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __construct(
                  $client_id = null,
                  $client_secret = null,
                  $redirect_uri = null,
                  $adminId = null, 
          Severity: Minor
          Found in AdminDAO.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 setClient has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function setClient(
                  $accessToken = null, 
                  $client_id = null, 
                  $client_secret = null, 
                  $redirect_uri = null, 
          Severity: Minor
          Found in AdminDAO.php - About 1 hr to fix

            Function authenticate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public function authenticate(
                    $client = null, 
                    $code = null, 
                    $token = null
                ){
            Severity: Minor
            Found in AdminDAO.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 createTables has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public function createTables(
                    $client = null,
                    $tableSchema = null,
                    $debug = null
                ){
            Severity: Minor
            Found in AdminDAO.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 readAdminSettings has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function readAdminSettings($fileName = null){
                    if ($fileName === null) { $fileName = $this->fileName; }
                    if (file_exists($fileName)){
                        require $fileName;
                        if (!isset($settings)||!is_array($settings)){
            Severity: Minor
            Found in AdminDAO.php - About 1 hr to fix

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

                      $client_id = null,
                      $client_secret = null,
                      $redirect_uri = null,
                      $adminId = null, 
                      $accessToken = null, 
              Severity: Major
              Found in AdminDAO.php - About 1 hr to fix

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

                        $accessToken = null, 
                        $client_id = null, 
                        $client_secret = null, 
                        $redirect_uri = null, 
                        $client = null
                Severity: Minor
                Found in AdminDAO.php - About 35 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status