File AbstractFormat.php
has 806 lines of code (exceeds 250 allowed). Consider refactoring.
<?php
namespace Phug\Formatter;
use Phug\Formatter;
AbstractFormat
has 40 functions (exceeds 20 allowed). Consider refactoring.
abstract class AbstractFormat implements FormatInterface, OptionInterface
{
use HandleVariable;
use OptionTrait;
use PatternTrait;
Method formatMixinCallElement
has 117 lines of code (exceeds 25 allowed). Consider refactoring.
protected function formatMixinCallElement(MixinCallElement $mixinCall)
{
$hasBlock = $mixinCall->hasChildren();
$children = new PhpUnwrap($this->formatElementChildren($mixinCall), $this->formatter);
$mixinName = $mixinCall->getName();
Method formatMixinElement
has 79 lines of code (exceeds 25 allowed). Consider refactoring.
protected function formatMixinElement(MixinElement $mixin)
{
$mixinName = $mixin->getName();
$name = is_string($mixinName)
? var_export($mixinName, true)
Method __construct
has 73 lines of code (exceeds 25 allowed). Consider refactoring.
public function __construct(?Formatter $formatter = null)
{
$patterns = [
'class_attribute' => static::CLASS_ATTRIBUTE,
'string_attribute' => static::STRING_ATTRIBUTE,
Function handleTokens
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
protected function handleTokens($code, $checked)
{
$phpTokenHandler = $this->getOption('php_token_handlers');
$untouched = false;
Method handleTokens
has 41 lines of code (exceeds 25 allowed). Consider refactoring.
protected function handleTokens($code, $checked)
{
$phpTokenHandler = $this->getOption('php_token_handlers');
$untouched = false;
Function formatMixinCallElement
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
protected function formatMixinCallElement(MixinCallElement $mixinCall)
{
$hasBlock = $mixinCall->hasChildren();
$children = new PhpUnwrap($this->formatElementChildren($mixinCall), $this->formatter);
$mixinName = $mixinCall->getName();
Function formatElementChildren
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
protected function formatElementChildren(ElementInterface $element, $indentStep = 1)
{
$indentLevel = $this->formatter->getLevel();
$this->formatter->setLevel($indentLevel + $indentStep);
$content = '';
Method setFormatter
has 35 lines of code (exceeds 25 allowed). Consider refactoring.
public function setFormatter(Formatter $formatter)
{
$this->formatter = $formatter;
$format = $this;
Method formatElementChildren
has 35 lines of code (exceeds 25 allowed). Consider refactoring.
protected function formatElementChildren(ElementInterface $element, $indentStep = 1)
{
$indentLevel = $this->formatter->getLevel();
$this->formatter->setLevel($indentLevel + $indentStep);
$content = '';
Method formatKeywordElement
has 28 lines of code (exceeds 25 allowed). Consider refactoring.
protected function formatKeywordElement(KeywordElement $element)
{
$name = $element->getName();
$keyword = $this->getOption(['keywords', $name]);
$result = call_user_func($keyword, $element->getValue(), $element, $name);
Function formatExpressionElement
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
protected function formatExpressionElement(ExpressionElement $code)
{
$value = $this->formatCode($code->getValue(), $code->isChecked(), !$code->isTransformationAllowed());
if ($code->hasStaticValue()) {
Function __construct
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
public function __construct(?Formatter $formatter = null)
{
$patterns = [
'class_attribute' => static::CLASS_ATTRIBUTE,
'string_attribute' => static::STRING_ATTRIBUTE,
Function formatDynamicValue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
protected function formatDynamicValue($formattedName, $value)
{
if ($value instanceof ExpressionElement &&
strtolower($value->getValue()) === 'undefined'
) {
There are no issues that match your filters.