roydejong/Enlighten

View on GitHub

Showing 21 of 21 total issues

Request has 41 functions (exceeds 20 allowed). Consider refactoring.
Open

class Request
{
    /**
     * The request method (e.g. POST, POST, PUT...)
     *
Severity: Minor
Found in lib/Http/Request.php - About 5 hrs to fix

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

    class Enlighten
    {
        /**
         * The incoming HTTP request being handled by the application.
         * Can be set manually via setRequest(), or will be built automatically when Enlighten::start() is called.
    Severity: Minor
    Found in lib/Enlighten.php - About 3 hrs to fix

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

      <?php
      
      namespace Enlighten\Http;
      
      /**
      Severity: Minor
      Found in lib/Http/Request.php - About 2 hrs to fix

        Function deflateFilesArray has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            private function deflateFilesArray(array $files)
            {
                /**
                 * This is where all the magic happens. This function converts a given $_FILES array to an array format that
                 * the Enlighten request handling code can understand. The goal is simple: convert the array to a workable
        Severity: Minor
        Found in lib/Http/Request.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

        Function start has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            public function start()
            {
                $this->beforeStart();
        
                // Begin output buffering and begin building the HTTP response
        Severity: Minor
        Found in lib/Enlighten.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

        File Enlighten.php has 257 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace Enlighten;
        
        use Enlighten\Http\Request;
        Severity: Minor
        Found in lib/Enlighten.php - About 2 hrs to fix

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

              public static function applyUrlVariables($urlPattern, array $variables)
              {
                  $regexPattern = '/([\\' . self::T_URL_VARIABLE . ']{1}[\\w]*)/';
          
                  $inputParts = explode('/', $urlPattern);
          Severity: Minor
          Found in lib/Routing/VariableUrl.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 start has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function start()
              {
                  $this->beforeStart();
          
                  // Begin output buffering and begin building the HTTP response
          Severity: Minor
          Found in lib/Enlighten.php - About 1 hr to fix

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

                public function action(Context $context = null)
                {
                    $targetFunc = null;
                    $classObject = null;
                    
            Severity: Minor
            Found in lib/Routing/Route.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 action has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function action(Context $context = null)
                {
                    $targetFunc = null;
                    $classObject = null;
                    
            Severity: Minor
            Found in lib/Routing/Route.php - About 1 hr to fix

              Function determineParamValue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function determineParamValue(\ReflectionParameter $parameter)
                  {
                      $class = $parameter->getClass();
              
                      if (!empty($class)) {
              Severity: Minor
              Found in lib/Context.php - About 55 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 getReflectionParameters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function getReflectionParameters(callable $callable)
                  {
                      $reflectionParams = [];
              
                      if (is_array($callable)) {
              Severity: Minor
              Found in lib/Context.php - About 55 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 setCookie has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function setCookie($name, $value, $expire = 0, $path = null, $domain = null, $secure = false, $httpOnly = false)
              Severity: Major
              Found in lib/Http/Response.php - About 50 mins to fix

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

                    public function dispatch(Route $route, Request $request = null)
                    {
                        $context = $this->context;
                
                        if (empty($this->context) && !empty($request)) {
                Severity: Minor
                Found in lib/Routing/Router.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

                Function createRegexMask has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function createRegexMask($urlPattern)
                    {
                        $parts = explode('/', $urlPattern);
                        $formattedRegex = '';
                
                
                Severity: Minor
                Found in lib/Routing/VariableUrl.php - About 35 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 trigger has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function trigger($eventType, Context $context = null)
                    {
                        $continue = true;
                
                        if (!isset($this->handlers[$eventType])) {
                Severity: Minor
                Found in lib/Routing/Filters.php - About 35 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

                Avoid too many return statements within this method.
                Open

                                return 'Could not create temporary file.';
                Severity: Major
                Found in lib/Http/FileUpload.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return null;
                  Severity: Major
                  Found in lib/Context.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return 'The upload was blocked.';
                    Severity: Major
                    Found in lib/Http/FileUpload.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return 'An unknown error occured.';
                      Severity: Major
                      Found in lib/Http/FileUpload.php - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language