Function interpolateTwigFunctions
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
protected function interpolateTwigFunctions(string $code): string
{
$tokens = array_slice(token_get_all('<?php '.$code), 1);
$output = '';
$count = count($tokens);
Function compileSource
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
public function compileSource(Source $source): string
{
$path = $source->getPath();
if ($this->pugSymfonyEngine->supports($path)) {
File HelpersHandler.php
has 273 lines of code (exceeds 250 allowed). Consider refactoring.
<?php
declare(strict_types=1);
namespace Pug\Symfony\Traits;
Method interpolateTwigFunctions
has 60 lines of code (exceeds 25 allowed). Consider refactoring.
protected function interpolateTwigFunctions(string $code): string
{
$tokens = array_slice(token_get_all('<?php '.$code), 1);
$output = '';
$count = count($tokens);
Method compileSource
has 46 lines of code (exceeds 25 allowed). Consider refactoring.
public function compileSource(Source $source): string
{
$path = $source->getPath();
if ($this->pugSymfonyEngine->supports($path)) {
Method getRendererOptions
has 45 lines of code (exceeds 25 allowed). Consider refactoring.
protected function getRendererOptions(): array
{
if ($this->options === null) {
$environment = $this->kernel->getEnvironment();
$projectDirectory = $this->kernel->getProjectDir();
Function copyTwigFunctions
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
protected function copyTwigFunctions(): void
{
$this->twigHelpers = [];
$twig = $this->getTwig();
$twig->env = $twig;
Method copyTwigFunctions
has 33 lines of code (exceeds 25 allowed). Consider refactoring.
protected function copyTwigFunctions(): void
{
$this->twigHelpers = [];
$twig = $this->getTwig();
$twig->env = $twig;
Method fromTwigEnvironment
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
public static function fromTwigEnvironment(
TwigEnvironment $baseTwig,
PugSymfonyEngine $pugSymfonyEngine,
ContainerInterface $container,
): static {
Function getRendererOptions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
protected function getRendererOptions(): array
{
if ($this->options === null) {
$environment = $this->kernel->getEnvironment();
$projectDirectory = $this->kernel->getProjectDir();
Avoid deeply nested control flow statements.
switch ($tokens[$index]) {
case '(':
$opening++;
$argumentNeedInterpolation = true;
$argument .= '(';
Avoid deeply nested control flow statements.
if ($newLine > $templateLine) {
$templateLine = $newLine;
$debugInfo[$codeFirstLine + $index] = $newLine;
}
Method installSymfonyBundle
has 6 arguments (exceeds 4 allowed). Consider refactoring.
IOInterface $io,
string $dir,
string $bundle,
string $bundleClass,
callable $proceedTask,
Method proceedTask
has 6 arguments (exceeds 4 allowed). Consider refactoring.
public static function proceedTask(&$flags, $io, $taskResult, $flag, $successMessage, $message)