Showing 1,086 of 1,086 total issues

Function compile has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    static function compile(array $tokens, array &$params, array $defaults = [], callable $wildcard = null) : string
    {
        $current = [
            'is_optional' => false,
            'skip'        => true,
Severity: Minor
Found in src/Route/Definition/Compiler.php - About 4 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 Resolver.php has 365 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 *
 */

Severity: Minor
Found in src/Resolver/Resolver.php - About 4 hrs to fix

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

    <?php
    /**
     *
     */
    
    
    Severity: Major
    Found in src/Request/Exception/Controller.php and 1 other location - About 4 hrs to fix
    src/Request/Error/Controller.php on lines 1..48

    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 165.

    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
    /**
     *
     */
    
    
    Severity: Major
    Found in src/Request/Error/Controller.php and 1 other location - About 4 hrs to fix
    src/Request/Exception/Controller.php on lines 1..49

    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 165.

    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

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

        static function emit(callable $callable, array $args = [], callable $callback = null)
        {
            if ($args && !is_string(key($args))) {
                return $callable(...$args);
            }
    Severity: Minor
    Found in src/Signal.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 gem has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function gem(Gem $gem, array $args = [])
        {
            if ($gem instanceof Factory) {
                return $this->invoke($this->child($gem, $args));
            }
    Severity: Minor
    Found in src/Resolver/Resolver.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 gem has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function gem(Gem $gem, array $args = [])
        {
            if ($gem instanceof Factory) {
                return $this->invoke($this->child($gem, $args));
            }
    Severity: Major
    Found in src/Resolver/Resolver.php - About 2 hrs to fix

      File init.php has 280 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       *
       */
      include __DIR__ . '/src/Signal.php';
      Severity: Minor
      Found in init.php - About 2 hrs to fix

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

            protected function hydrate(Plugin $plugin, $service)
            {
                foreach($plugin->calls() as $method => $args) {
                    if (is_string($method)) {
                        if (INDEX == $method[0]) {
        Severity: Minor
        Found in src/Resolver/Resolver.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 create has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            static function create(string $name, array $args, callable $callback)
            {
                $class = static::reflectionClass($name);
        
                if (null === $class->constructor()) {
        Severity: Minor
        Found in src/Service/Builder.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 emit has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            static function emit(callable $callable, array $args = [], callable $callback = null)
            {
                if ($args && !is_string(key($args))) {
                    return $callable(...$args);
                }
        Severity: Major
        Found in src/Signal.php - About 2 hrs to fix

          Method compile has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              static function compile(array $tokens, array &$params, array $defaults = [], callable $wildcard = null) : string
              {
                  $current = [
                      'is_optional' => false,
                      'skip'        => true,
          Severity: Major
          Found in src/Route/Definition/Compiler.php - About 2 hrs to fix

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

                protected function regex(array $tokens) : string
                {
                    $regex = '';
            
                    foreach($tokens as $token) {
            Severity: Minor
            Found in src/Route/Definition/Regex.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 create has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                static function create(string $name, array $args, callable $callback)
                {
                    $class = static::reflectionClass($name);
            
                    if (null === $class->constructor()) {
            Severity: Minor
            Found in src/Service/Builder.php - About 1 hr to fix

              Method tokens has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function tokens(string $path, array $constraints = []) : array
                  {
                      $currentPos = 0;
                      $length     = strlen($path);
                      $level      = 0;
              Severity: Minor
              Found in src/Route/Definition/Tokens.php - About 1 hr to fix

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

                    protected function tokens(string $path, array $constraints = []) : array
                    {
                        $currentPos = 0;
                        $length     = strlen($path);
                        $level      = 0;
                Severity: Minor
                Found in src/Route/Definition/Tokens.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 hydrate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function hydrate(Plugin $plugin, $service)
                    {
                        foreach($plugin->calls() as $method => $args) {
                            if (is_string($method)) {
                                if (INDEX == $method[0]) {
                Severity: Minor
                Found in src/Resolver/Resolver.php - About 1 hr to fix

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

                          string $message = '', int $code = 0, int $severity = E_ERROR,
                          string $file = __FILE__, int $line = __LINE__, \Throwable $previous = null, int $offset = 2
                  Severity: Major
                  Found in src/Exception/Generator.php - About 50 mins to fix

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

                    <?php
                    /**
                     *
                     */
                    
                    
                    Severity: Major
                    Found in src/Http/Error/Forbidden.php and 5 other locations - About 40 mins to fix
                    src/Http/Error/BadRequest.php on lines 1..27
                    src/Http/Error/MethodNotAllowed.php on lines 1..27
                    src/Http/Error/NotFound.php on lines 1..27
                    src/Http/Error/ServerError.php on lines 1..27
                    src/Http/Error/Unauthorized.php on lines 1..27

                    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 93.

                    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 6 locations. Consider refactoring.
                    Open

                    <?php
                    /**
                     *
                     */
                    
                    
                    Severity: Major
                    Found in src/Http/Error/Unauthorized.php and 5 other locations - About 40 mins to fix
                    src/Http/Error/BadRequest.php on lines 1..27
                    src/Http/Error/Forbidden.php on lines 1..27
                    src/Http/Error/MethodNotAllowed.php on lines 1..27
                    src/Http/Error/NotFound.php on lines 1..27
                    src/Http/Error/ServerError.php on lines 1..27

                    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 93.

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language