elcodedocle/gplusraffle

View on GitHub
MainController.php

Summary

Maintainability
F
4 days
Test Coverage

Method processRaffleAction has 203 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function processRaffleAction($request = null){

        if ($request === null){
            $request = $this->request;
        }
Severity: Major
Found in MainController.php - About 1 day to fix

    File MainController.php has 473 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 MainController.php - About 7 hrs to fix

      Function processRaffleAction has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          private function processRaffleAction($request = null){
      
              if ($request === null){
                  $request = $this->request;
              }
      Severity: Minor
      Found in MainController.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 processAdminAction has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          private function processAdminAction($request = null){
              
              if ($request === null){
                  $request = $this->request;
              }
      Severity: Minor
      Found in MainController.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 processAdminAction has 75 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function processAdminAction($request = null){
              
              if ($request === null){
                  $request = $this->request;
              }
      Severity: Major
      Found in MainController.php - About 3 hrs to fix

        Method getListRaffleFilterArray has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function getListRaffleFilterArray($userId, $isAdmin = false, $request = null){
        
                if ($request === null){
                    $request = $this->request;
                }
        Severity: Major
        Found in MainController.php - About 2 hrs to fix

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

              private function getListRaffleFilterArray($userId, $isAdmin = false, $request = null){
          
                  if ($request === null){
                      $request = $this->request;
                  }
          Severity: Minor
          Found in MainController.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 14 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  $request,
                  $client_id = null,
                  $client_secret = null,
                  $redirect_uri = null,
                  $admin_redirect_uri = null,
          Severity: Major
          Found in MainController.php - About 1 hr to fix

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

                private function processUserAction($request = null){
            
                    if ($request === null){
                        $request = $this->request;
                    }
            Severity: Minor
            Found in MainController.php - About 1 hr to fix

              Method process has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function process(){
                      
                      if (!isset($this->request['collection'])){
                          throw new Exception(
                              'The request does not contain a collection.', 
              Severity: Minor
              Found in MainController.php - About 1 hr to fix

                Function processUserAction has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function processUserAction($request = null){
                
                        if ($request === null){
                            $request = $this->request;
                        }
                Severity: Minor
                Found in MainController.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 process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function process(){
                        
                        if (!isset($this->request['collection'])){
                            throw new Exception(
                                'The request does not contain a collection.', 
                Severity: Minor
                Found in MainController.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

                There are no issues that match your filters.

                Category
                Status