src/Resolver/Resolver.php

Summary

Maintainability
D
2 days
Test Coverage

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

    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

      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

      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

        Avoid too many return statements within this method.
        Open

                    return $this->call($this->resolve($gem->config()), $this->vars($args, $gem->args()));
        Severity: Major
        Found in src/Resolver/Resolver.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return $this->filterable($gem, $this->vars($args, $gem->args()));
          Severity: Major
          Found in src/Resolver/Resolver.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return fn(...$argv) => $this->resolve($this->call(
                            $this->resolve($gem->config()), $this->vars($this->variadic($argv), $gem->args())
                        ));
            Severity: Major
            Found in src/Resolver/Resolver.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return clone $this->resolve($gem->config(), $args);
              Severity: Major
              Found in src/Resolver/Resolver.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return $this->shared($gem->name(), $gem->config(), $args);
                Severity: Major
                Found in src/Resolver/Resolver.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return Unresolvable::plugin($gem);
                  Severity: Major
                  Found in src/Resolver/Resolver.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return $this->resolve($this->param($gem->name()), $args);
                    Severity: Major
                    Found in src/Resolver/Resolver.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return $this->configured($gem->name());
                      Severity: Major
                      Found in src/Resolver/Resolver.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return ($this->provider() ?? new Unresolvable)($gem->config(), $this->vars($args, $gem->args()));
                        Severity: Major
                        Found in src/Resolver/Resolver.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return $this->resolve($gem->exception(), $gem->args($exception, $args));
                          Severity: Major
                          Found in src/Resolver/Resolver.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return (new class() {
                                            function __invoke($file) {
                                                return include $file;
                                            }
                                        })($this->resolve($gem->config()));
                            Severity: Major
                            Found in src/Resolver/Resolver.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                          return $gem->config();
                              Severity: Major
                              Found in src/Resolver/Resolver.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                            return $this->args($gem->config());
                                Severity: Major
                                Found in src/Resolver/Resolver.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                              return $this->scoped($gem->closure(), $gem->scoped());
                                  Severity: Major
                                  Found in src/Resolver/Resolver.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                return $this;
                                    Severity: Major
                                    Found in src/Resolver/Resolver.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                      return $this->resolve($gem->plugin(), $args);
                                      Severity: Major
                                      Found in src/Resolver/Resolver.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                    return fn(...$argv) => $this->resolve($gem->config(), $this->vars($this->variadic($argv), $gem->args()));
                                        Severity: Major
                                        Found in src/Resolver/Resolver.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                  return $this->resolve($plugin, $args);
                                          Severity: Major
                                          Found in src/Resolver/Resolver.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                        return $this->config;
                                            Severity: Major
                                            Found in src/Resolver/Resolver.php - About 30 mins to fix

                                              syntax error, unexpected '...' (T_ELLIPSIS), expecting ']'
                                              Open

                                                          !$child ? $parent : (is_string(key($child)) ? $child + $parent : [...$child, ...$parent])
                                              Severity: Critical
                                              Found in src/Resolver/Resolver.php by phan

                                              There are no issues that match your filters.

                                              Category
                                              Status