divineniiquaye/rade-di

View on GitHub

Showing 100 of 100 total issues

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

    public function parameter(string $value): mixed
    {
        $res = [];
        $parts = \preg_split('#(%[^%\s]+%)#i', $value, -1, \PREG_SPLIT_DELIM_CAPTURE);

Severity: Minor
Found in src/Traits/ParameterTrait.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 bootExtensions has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function bootExtensions(array $extensions, \SplStack &$afterLoading, string $extraKey = null): void
    {
        $container = $this->container;

        foreach ($extensions as $resolved) {
Severity: Minor
Found in src/Extensions/ExtensionBuilder.php - About 1 hr to fix

    Method resolveReference has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function resolveReference(string $reference): mixed
        {
            $invalidBehavior = $this->container::EXCEPTION_ON_MULTIPLE_SERVICE;
    
            if ('?' === $reference[0]) {
    Severity: Minor
    Found in src/Resolver.php - About 1 hr to fix

      Method resolveStmt has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function resolveStmt(array $expressions, string $parentId, bool $leaveNodes = false): void
          {
              foreach ($expressions as &$expression) {
                  if ($expression instanceof Expression || $expression instanceof Return_) {
                      $expression = $expression->expr;
      Severity: Minor
      Found in src/NodeVisitor/AutowiringResolver.php - About 1 hr to fix

        Method resolveClass has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function resolveClass(string $class, array $args = []): object
            {
                if (\is_subclass_of($class, ServiceProviderInterface::class)) {
                    $services = [];
        
        
        Severity: Minor
        Found in src/Resolver.php - About 1 hr to fix

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

              public function compile(array $options = [])
              {
                  $options += ['strictType' => true, 'printToString' => true, 'containerClass' => 'CompiledContainer'];
                  $astNodes = $options['strictType'] ? [new Declare_([new DeclareDeclare('strict_types', $this->resolver->getBuilder()->val(1))])] : [];
                  $processedData = $this->doAnalyse($this->definitions);
          Severity: Minor
          Found in src/ContainerBuilder.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 resolveProxies has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function resolveProxies(ContainerBuilder $container, BuilderFactory $builder, array $proxiedServices): array
              {
                  $builtProxies = [];
          
                  foreach ($proxiedServices as $method => $proxy) {
          Severity: Minor
          Found in src/Facade/FacadeProxy.php - About 1 hr to fix

            Method buildTraits has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function buildTraits(string $cacheDirectory, array $includePaths = []): string
                {
                    $traitsDirectory = \rtrim($cacheDirectory, '/') . '/Definitions' . $this->traitHash($cacheDirectory);
                    $autoLoadAst = [];
            
            
            Severity: Minor
            Found in src/NodeVisitor/DefinitionsSplitter.php - About 1 hr to fix

              Method sortExtensions has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function sortExtensions(array $extensions): array
                  {
                      if (0 === \count($extensions)) {
                          return [];
                      }
              Severity: Minor
              Found in src/Extensions/ExtensionBuilder.php - About 1 hr to fix

                Method autowireArguments has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function autowireArguments(\ReflectionFunctionAbstract $function, array $args = []): array
                    {
                        $resolvedParameters = [];
                        $nullValuesFound = 0;
                        $args = $this->resolveArguments($args); // Resolves provided arguments.
                Severity: Minor
                Found in src/Resolver.php - About 1 hr to fix

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

                      public function resolveCallable(callable|array $callback, array $arguments = []): mixed
                      {
                          if (\is_array($callback)) {
                              if ((2 === \count($callback) && \array_is_list($callback)) && \is_string($callback[1])) {
                                  $callback[0] = $this->resolve($callback[0]);
                  Severity: Minor
                  Found in src/Resolver.php - About 1 hr to fix

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

                        public static function getTypes(\Reflector $reflection): array
                        {
                            if ($reflection instanceof \ReflectionParameter || $reflection instanceof \ReflectionProperty) {
                                $type = $reflection->getType();
                            } elseif ($reflection instanceof \ReflectionFunctionAbstract) {
                    Severity: Minor
                    Found in src/Resolver.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

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

                        public function typed(string ...$to)
                        {
                            $this->options['typed'] = true;
                    
                            if ([] === $to) {
                    Severity: Minor
                    Found in src/Definition.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 load has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function load($resource, string $type = null): void
                        {
                            $container = $this->builder->getContainer();
                    
                            $path = $this->locator->locate($resource);
                    Severity: Minor
                    Found in src/Loader/PhpFileLoader.php - About 1 hr to fix

                      Method resolve has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function resolve(Container $container): array
                          {
                              $i = 0;
                              $services = $refs = [];
                      
                      
                      Severity: Minor
                      Found in src/Definitions/TaggedLocator.php - About 1 hr to fix

                        Method doLoad has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function doLoad(string $id, int $invalidBehavior): mixed
                            {
                                if (null == ($definition = $this->definitions[$id] ?? null)) {
                                    if (\array_key_exists($id, $this->types)) {
                                        return $this->autowired($id, 1 === ($invalidBehavior & self::EXCEPTION_ON_MULTIPLE_SERVICE));
                        Severity: Minor
                        Found in src/Container.php - About 1 hr to fix

                          Method afterTraverse has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function afterTraverse(array $nodes)
                              {
                                  $node = $nodes[1] ?? $nodes[0];
                          
                                  if (isset($nodes[0]) && $nodes[0] instanceof Declare_) {
                          Severity: Minor
                          Found in src/NodeVisitor/DefinitionsSplitter.php - About 1 hr to fix

                            Method resolveArguments has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function resolveArguments(array $arguments = []): array
                                {
                                    foreach ($arguments as $key => $value) {
                                        if (\is_array($value)) {
                                            $resolved = $this->resolveArguments($value);
                            Severity: Minor
                            Found in src/Resolver.php - About 1 hr to fix

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

                                  public function load($resource, string $type = null): void
                                  {
                                      $container = $this->builder->getContainer();
                              
                                      $path = $this->locator->locate($resource);
                              Severity: Minor
                              Found in src/Loader/PhpFileLoader.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 enterNode has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function enterNode(\PhpParser\Node $node)
                                  {
                                      if (!$node instanceof \PhpParser\Node\Stmt\ClassMethod) {
                                          return parent::enterNode($node);
                                      }
                              Severity: Minor
                              Found in src/NodeVisitor/MethodsResolver.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

                              Severity
                              Category
                              Status
                              Source
                              Language