Showing 14 of 102 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);
- Read upRead up
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 compileSource
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function compileSource(Source $source): string
{
$path = $source->getPath();
if ($this->pugSymfonyEngine->supports($path)) {
- Read upRead up
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
File HelpersHandler.php
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Pug\Symfony\Traits;
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);
Method compileSource
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
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. Open
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. Open
protected function copyTwigFunctions(): void
{
$this->twigHelpers = [];
$twig = $this->getTwig();
$twig->env = $twig;
- Read upRead up
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 copyTwigFunctions
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function copyTwigFunctions(): void
{
$this->twigHelpers = [];
$twig = $this->getTwig();
$twig->env = $twig;
Method fromTwigEnvironment
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function fromTwigEnvironment(
TwigEnvironment $baseTwig,
PugSymfonyEngine $pugSymfonyEngine,
ContainerInterface $container,
): static {
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();
- Read upRead up
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 deeply nested control flow statements. Open
if ($newLine > $templateLine) {
$templateLine = $newLine;
$debugInfo[$codeFirstLine + $index] = $newLine;
}
Avoid deeply nested control flow statements. Open
switch ($tokens[$index]) {
case '(':
$opening++;
$argumentNeedInterpolation = true;
$argument .= '(';
Method installSymfonyBundle
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
IOInterface $io,
string $dir,
string $bundle,
string $bundleClass,
callable $proceedTask,
Method proceedTask
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function proceedTask(&$flags, $io, $taskResult, $flag, $successMessage, $message)