squirrelphp/queries-bundle

View on GitHub

Showing 15 of 15 total issues

Function getPossibleCombinations has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function getPossibleCombinations(array $elements, int $combinationsLevel): array
    {
        $baseCount = \count($elements);
        $result    = [];

Severity: Minor
Found in src/Twig/SquirrelQueriesExtension.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 getBaseImplementation has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getBaseImplementation(ContainerBuilder $container, string $serviceId, array $tag): Definition
    {
        // Connection with this name already exists - each connection name has to be unique
        if ($container->hasDefinition('squirrel.connection.' . $tag['connectionName'])) {
            throw new \LogicException(
Severity: Minor
Found in src/DependencyInjection/Compiler/LayersPass.php - About 1 hr to fix

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

        private function sanitizeQuery(string $connectionName, array $query): array
        {
            $query['explainable'] = true;
            $query['params'] ??= array();
            if (!\is_array($query['params'])) {
    Severity: Minor
    Found in src/DataCollector/SquirrelDataCollector.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 getGroupedQueries has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getGroupedQueries(): array
        {
            if ($this->groupedQueries !== null) {
                return $this->groupedQueries;
            }
    Severity: Minor
    Found in src/DataCollector/SquirrelDataCollector.php - About 1 hr to fix

      Method replaceQueryParameters has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function replaceQueryParameters(string $query, array|Data $parameters): string
          {
              if ($parameters instanceof Data) {
                  $parameters = $parameters->getValue(true);
      
      
      Severity: Minor
      Found in src/Twig/SquirrelQueriesExtension.php - About 1 hr to fix

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

            public function getGroupedQueries(): array
            {
                if ($this->groupedQueries !== null) {
                    return $this->groupedQueries;
                }
        Severity: Minor
        Found in src/DataCollector/SquirrelDataCollector.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 minifyQuery has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function minifyQuery(string $query): string
            {
                $result   = '';
                $keywords = [];
                $required = 1;
        Severity: Minor
        Found in src/Twig/SquirrelQueriesExtension.php - About 1 hr to fix

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

              private function getPossibleCombinations(array $elements, int $combinationsLevel): array
              {
                  $baseCount = \count($elements);
                  $result    = [];
          
          
          Severity: Minor
          Found in src/Twig/SquirrelQueriesExtension.php - About 1 hr to fix

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

                private function createConnectionFromTag(
                    ContainerBuilder $container,
                    string $id,
                    array $tag,
                    array $taggedServicesOrdered,
            Severity: Minor
            Found in src/DependencyInjection/Compiler/LayersPass.php - About 1 hr to fix

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

                  private function sortLayers(array $taggedServices): array
                  {
                      // Ordered services according to priority
                      $taggedServicesOrdered = [];
              
              
              Severity: Minor
              Found in src/DependencyInjection/Compiler/LayersPass.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 escapeFunction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function escapeFunction(mixed $parameter): string
                  {
                      $result = $parameter;
              
                      switch (true) {
              Severity: Minor
              Found in src/Twig/SquirrelQueriesExtension.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 getBaseImplementation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function getBaseImplementation(ContainerBuilder $container, string $serviceId, array $tag): Definition
                  {
                      // Connection with this name already exists - each connection name has to be unique
                      if ($container->hasDefinition('squirrel.connection.' . $tag['connectionName'])) {
                          throw new \LogicException(
              Severity: Minor
              Found in src/DependencyInjection/Compiler/LayersPass.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 shrinkParameters has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function shrinkParameters(array $parameters, array $combination): string
                  {
                      \array_shift($parameters);
                      $result = '';
              
              
              Severity: Minor
              Found in src/Twig/SquirrelQueriesExtension.php - About 35 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 minifyQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function minifyQuery(string $query): string
                  {
                      $result   = '';
                      $keywords = [];
                      $required = 1;
              Severity: Minor
              Found in src/Twig/SquirrelQueriesExtension.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

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

                  private function sanitizeParam(mixed $var): array
                  {
                      if (\is_object($var)) {
                          $className = \get_class($var);
              
              
              Severity: Minor
              Found in src/DataCollector/SquirrelDataCollector.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

              Severity
              Category
              Status
              Source
              Language