Aerendir/bundle-features

View on GitHub
src/DependencyInjection/Configuration.php

Summary

Maintainability
D
1 day
Test Coverage

File Configuration.php has 375 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

/*
Severity: Minor
Found in src/DependencyInjection/Configuration.php - About 5 hrs to fix

    Method getConfigTreeBuilder has 94 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getConfigTreeBuilder(): TreeBuilder
        {
            $treeBuilder = new TreeBuilder('shq_features');
            $rootNode    = $treeBuilder->getRootNode();
    
    
    Severity: Major
    Found in src/DependencyInjection/Configuration.php - About 3 hrs to fix

      Configuration has 26 functions (exceeds 20 allowed). Consider refactoring.
      Open

      final class Configuration implements ConfigurationInterface
      {
          /** @var string[] The allowed drawers */
          private const ALLOWED_DRAWERS = ['plain_text'];
      
      
      Severity: Minor
      Found in src/DependencyInjection/Configuration.php - About 3 hrs to fix

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

            private function validatePackages(string $set, string $feature, array $packs, string $subscriptionType): void
            {
                // If empty, may be because it doesn't exist and the TreeBuilder created it as an empty array, else...
                if (false === empty($packs)) {
                    // ... It contains packages: validate the number of units and their prices
        Severity: Minor
        Found in src/DependencyInjection/Configuration.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 processPackages has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            private function processPackages(array $packs, $subscriptionType): array
            {
                $subscriptionHasFreePackage = false;
                foreach ($packs as $numOfUnits => $prices) {
                    switch ($subscriptionType) {
        Severity: Minor
        Found in src/DependencyInjection/Configuration.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

        Avoid too many return statements within this method.
        Open

                return $treeBuilder;
        Severity: Major
        Found in src/DependencyInjection/Configuration.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                              return $this->processTree($tree);
          Severity: Major
          Found in src/DependencyInjection/Configuration.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                return $this->validateTree($tree);
            Severity: Major
            Found in src/DependencyInjection/Configuration.php - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status