themichaelhall/bluemvc-core

View on GitHub

Showing 29 of 34 total issues

AbstractRequest has 38 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class AbstractRequest implements RequestInterface
{
    /**
     * Constructs the request.
     *
Severity: Minor
Found in src/Base/AbstractRequest.php - About 5 hrs to fix

    AbstractApplication has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class AbstractApplication implements ApplicationInterface
    {
        use CustomItemsTrait;
    
        /**
    Severity: Minor
    Found in src/Base/AbstractApplication.php - About 3 hrs to fix

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

          private static function actionMethodParameterMatchesParameter(ReflectionParameter $reflectionParameter, string $parameter, mixed &$adjustedParameter = null): bool
          {
              $adjustedParameter = $parameter;
      
              $reflectionParameterType = $reflectionParameter->getType();
      Severity: Minor
      Found in src/Traits/ControllerTrait.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 AbstractApplication.php has 251 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      /**
       * This file is a part of the bluemvc-core package.
       *
      Severity: Minor
      Found in src/Base/AbstractApplication.php - About 2 hrs to fix

        Method actionMethodParameterMatchesParameter has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static function actionMethodParameterMatchesParameter(ReflectionParameter $reflectionParameter, string $parameter, mixed &$adjustedParameter = null): bool
            {
                $adjustedParameter = $parameter;
        
                $reflectionParameterType = $reflectionParameter->getType();
        Severity: Minor
        Found in src/Traits/ControllerTrait.php - About 1 hr to fix

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

              public function matches(RequestInterface $request): ?RouteMatchInterface
              {
                  $path = $request->getUrl()->getPath();
                  $directoryParts = $path->getDirectoryParts();
                  $filename = $path->getFilename() ?? '';
          Severity: Minor
          Found in src/Route.php - About 1 hr to fix

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

                private static function actionMethodMatchesParameters(ReflectionMethod $reflectionMethod, array $parameters, array &$adjustedParameters = null): bool
                {
                    $parametersCount = count($parameters);
            
                    if ($reflectionMethod->getNumberOfParameters() < $parametersCount) {
            Severity: Minor
            Found in src/Traits/ControllerTrait.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 __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    UrlInterface $url,
                    MethodInterface $method,
                    HeaderCollectionInterface $headers,
                    ParameterCollectionInterface $queryParameters,
                    ParameterCollectionInterface $formParameters,
            Severity: Major
            Found in src/Base/AbstractRequest.php - About 1 hr to fix

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

                  public function matches(RequestInterface $request): ?RouteMatchInterface
                  {
                      $path = $request->getUrl()->getPath();
                      $directoryParts = $path->getDirectoryParts();
                      $filename = $path->getFilename() ?? '';
              Severity: Minor
              Found in src/Route.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 setCookieValue has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function setCookieValue(string $name, string $value, ?DateTimeInterface $expiry = null, ?UrlPathInterface $path = null, ?HostInterface $domain = null, bool $isSecure = false, bool $isHttpOnly = false): void
              Severity: Major
              Found in src/Base/AbstractResponse.php - About 50 mins to fix

                Method setCookieValue has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function setCookieValue(string $name, string $value, ?DateTimeInterface $expiry = null, ?UrlPathInterface $path = null, ?HostInterface $domain = null, bool $isSecure = false, bool $isHttpOnly = false): void;
                Severity: Major
                Found in src/Interfaces/ResponseInterface.php - About 50 mins to fix

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

                      public function updateResponse(ApplicationInterface $application, RequestInterface $request, ResponseInterface $response, string $viewPath, string $action, ViewItemCollectionInterface $viewItems): void;
                  Severity: Minor
                  Found in src/Interfaces/ViewInterface.php - About 45 mins to fix

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

                        private function doRun(RequestInterface $request, ResponseInterface $response): void
                        {
                            $throwable = null;
                    
                            foreach ($this->plugins as $plugin) {
                    Severity: Minor
                    Found in src/Base/AbstractApplication.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 updateResponse has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function updateResponse(ApplicationInterface $application, RequestInterface $request, ResponseInterface $response, string $viewPath, string $action, ViewItemCollectionInterface $viewItems): void
                    Severity: Minor
                    Found in src/View.php - About 45 mins to fix

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

                          public function __construct(string $value, ?DateTimeInterface $expiry = null, ?UrlPathInterface $path = null, ?HostInterface $domain = null, bool $isSecure = false, bool $isHttpOnly = false)
                      Severity: Minor
                      Found in src/ResponseCookie.php - About 45 mins to fix

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

                            public function processRequest(ApplicationInterface $application, RequestInterface $request, ResponseInterface $response, string $action, array $parameters = []): void
                        Severity: Minor
                        Found in src/Controller.php - About 35 mins to fix

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

                              private function tryInvokeActionMethod(string $action, array $parameters, bool $isCaseSensitive, callable $resultHandler, ?bool &$hasFoundActionMethod = null): bool
                          Severity: Minor
                          Found in src/Traits/ControllerTrait.php - About 35 mins to fix

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

                                abstract public function renderView(ApplicationInterface $application, RequestInterface $request, FilePathInterface $viewFile, mixed $model = null, ?ViewItemCollectionInterface $viewItems = null): string;
                            Severity: Minor
                            Found in src/Base/AbstractViewRenderer.php - About 35 mins to fix

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

                                  public function renderView(ApplicationInterface $application, RequestInterface $request, FilePathInterface $viewFile, mixed $model = null, ?ViewItemCollectionInterface $viewItems = null): string;
                              Severity: Minor
                              Found in src/Interfaces/ViewRendererInterface.php - About 35 mins to fix

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

                                    public function processRequest(ApplicationInterface $application, RequestInterface $request, ResponseInterface $response, string $action, array $parameters = []): void;
                                Severity: Minor
                                Found in src/Interfaces/ControllerInterface.php - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language