pug-php/pug-symfony

View on GitHub
src/Pug/Symfony/Traits/HelpersHandler.php

Summary

Maintainability
D
2 days
Test Coverage

Showing 17 of 17 total issues

Function interpolateTwigFunctions has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

protected function interpolateTwigFunctions(string $code): string
{
$tokens = array_slice(token_get_all('<?php '.$code), 1);
$output = '';
$count = count($tokens);
Severity: Minor
Found in src/Pug/Symfony/Traits/HelpersHandler.php - About 5 hrs to fix

File HelpersHandler.php has 273 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
 
declare(strict_types=1);
 
namespace Pug\Symfony\Traits;
Severity: Minor
Found in src/Pug/Symfony/Traits/HelpersHandler.php - About 2 hrs to fix

    Method interpolateTwigFunctions has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    protected function interpolateTwigFunctions(string $code): string
    {
    $tokens = array_slice(token_get_all('<?php '.$code), 1);
    $output = '';
    $count = count($tokens);
    Severity: Major
    Found in src/Pug/Symfony/Traits/HelpersHandler.php - About 2 hrs to fix

      Method getRendererOptions has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      protected function getRendererOptions(): array
      {
      if ($this->options === null) {
      $environment = $this->kernel->getEnvironment();
      $projectDirectory = $this->kernel->getProjectDir();
      Severity: Minor
      Found in src/Pug/Symfony/Traits/HelpersHandler.php - About 1 hr to fix

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

        protected function copyTwigFunctions(): void
        {
        $this->twigHelpers = [];
        $twig = $this->getTwig();
        $twig->env = $twig;
        Severity: Minor
        Found in src/Pug/Symfony/Traits/HelpersHandler.php - About 1 hr to fix

        Method copyTwigFunctions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        protected function copyTwigFunctions(): void
        {
        $this->twigHelpers = [];
        $twig = $this->getTwig();
        $twig->env = $twig;
        Severity: Minor
        Found in src/Pug/Symfony/Traits/HelpersHandler.php - About 1 hr to fix

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

          protected function getRendererOptions(): array
          {
          if ($this->options === null) {
          $environment = $this->kernel->getEnvironment();
          $projectDirectory = $this->kernel->getProjectDir();
          Severity: Minor
          Found in src/Pug/Symfony/Traits/HelpersHandler.php - About 55 mins to fix

          Avoid deeply nested control flow statements.
          Open

          switch ($tokens[$index]) {
          case '(':
          $opening++;
          $argumentNeedInterpolation = true;
          $argument .= '(';
          Severity: Major
          Found in src/Pug/Symfony/Traits/HelpersHandler.php - About 45 mins to fix

            The method interpolateTwigFunctions() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10.
            Open

            protected function interpolateTwigFunctions(string $code): string
            {
            $tokens = array_slice(token_get_all('<?php '.$code), 1);
            $output = '';
            $count = count($tokens);

            The method getRendererOptions() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
            Open

            protected function getRendererOptions(): array
            {
            if ($this->options === null) {
            $environment = $this->kernel->getEnvironment();
            $projectDirectory = $this->kernel->getProjectDir();

            Avoid assigning values to variables in if clauses and the like (line '88', column '18').
            Open

            protected function getRendererOptions(): array
            {
            if ($this->options === null) {
            $environment = $this->kernel->getEnvironment();
            $projectDirectory = $this->kernel->getProjectDir();

            Avoid assigning values to variables in if clauses and the like (line '89', column '26').
            Open

            protected function getRendererOptions(): array
            {
            if ($this->options === null) {
            $environment = $this->kernel->getEnvironment();
            $projectDirectory = $this->kernel->getProjectDir();

            syntax error, unexpected 'ContainerInterface' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)
            Open

            protected ContainerInterface $container;
            Severity: Critical
            Found in src/Pug/Symfony/Traits/HelpersHandler.php by phan

            Avoid excessively long variable names like $argumentNeedInterpolation. Keep variable name length under 20.
            Open

            $argumentNeedInterpolation = false;

            Avoid excessively long variable names like $argumentNeedInterpolation. Keep variable name length under 20.
            Open

            protected function pushArgument(array &$arguments, string &$argument, bool &$argumentNeedInterpolation): void

            Space before opening parenthesis of function call prohibited
            Open

            static fn ($path) => $path !== $baseDir,

            Line indented incorrectly; expected 12 spaces, found 16
            Open

            static fn ($path) => $path !== $baseDir,
            Category
            Status