themichaelhall/bluemvc-core

View on GitHub

Showing 34 of 34 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<?php

/**
 * This file is a part of the bluemvc-core package.
 *
Severity: Major
Found in src/Collections/ResponseCookieCollection.php and 2 other locations - About 6 hrs to fix
src/Collections/RequestCookieCollection.php on lines 1..136
src/Collections/UploadedFileCollection.php on lines 1..136

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 222.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<?php

/**
 * This file is a part of the bluemvc-core package.
 *
Severity: Major
Found in src/Collections/RequestCookieCollection.php and 2 other locations - About 6 hrs to fix
src/Collections/ResponseCookieCollection.php on lines 1..136
src/Collections/UploadedFileCollection.php on lines 1..136

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 222.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<?php

/**
 * This file is a part of the bluemvc-core package.
 *
Severity: Major
Found in src/Collections/UploadedFileCollection.php and 2 other locations - About 6 hrs to fix
src/Collections/RequestCookieCollection.php on lines 1..136
src/Collections/ResponseCookieCollection.php on lines 1..136

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 222.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php

/**
 * This file is a part of the bluemvc-core package.
 *
Severity: Major
Found in src/Collections/ViewItemCollection.php and 1 other location - About 6 hrs to fix
src/Collections/CustomItemCollection.php on lines 1..135

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 208.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php

/**
 * This file is a part of the bluemvc-core package.
 *
Severity: Major
Found in src/Collections/CustomItemCollection.php and 1 other location - About 6 hrs to fix
src/Collections/ViewItemCollection.php on lines 1..135

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 208.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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
                        Severity
                        Category
                        Status
                        Source
                        Language