divineniiquaye/rade-di

View on GitHub
src/Extensions/ExtensionBuilder.php

Summary

Maintainability
C
1 day
Test Coverage

Function bootExtensions has a Cognitive Complexity of 28 (exceeds 5 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 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

Function sortExtensions has a Cognitive Complexity of 14 (exceeds 5 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

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

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

          private function mergeConfig(array $a, array $b, bool $replace): array
          {
              foreach ($b as $k => $v) {
                  if (\array_key_exists($k, $a)) {
                      if (!\is_array($v)) {
      Severity: Minor
      Found in src/Extensions/ExtensionBuilder.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 getConfig has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getConfig(string $extensionName, string $parent = null)
          {
              $configuration = &$this->configuration;
      
              if (!(\array_key_exists($extensionName, $this->extensions) || \array_key_exists($extensionName, $this->aliases))) {
      Severity: Minor
      Found in src/Extensions/ExtensionBuilder.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

      Function modifyConfig has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function modifyConfig(string $extensionName, array $configuration, string $parent = null, bool $replace = false): void
          {
              if (!\array_key_exists($extensionName, $this->extensions)) {
                  throw new \InvalidArgumentException(\sprintf('The extension "%s" provided in not valid, must be an extension\'s class name.', $extensionName));
              }
      Severity: Minor
      Found in src/Extensions/ExtensionBuilder.php - About 25 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

      There are no issues that match your filters.

      Category
      Status