Showing 48 of 48 total issues
Function isInExclusionContext
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function isInExclusionContext(&$tokens, $index)
{
foreach ([
// Exclude tokens before the variables
-1 => [
- 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 provideAttributesAssignment
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function provideAttributesAssignment()
{
return $this
->registerHelper(
'attributes_mapping',
Function formatMixinCallElement
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function formatMixinCallElement(MixinCallElement $mixinCall)
{
$hasBlock = $mixinCall->hasChildren();
$children = new PhpUnwrap($this->formatElementChildren($mixinCall), $this->formatter);
$mixinName = $mixinCall->getName();
- 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 formatElementChildren
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function formatElementChildren(ElementInterface $element, $indentStep = 1)
{
$indentLevel = $this->formatter->getLevel();
$this->formatter->setLevel($indentLevel + $indentStep);
$content = '';
- 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 setFormatter
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setFormatter(Formatter $formatter)
{
$this->formatter = $formatter;
$format = $this;
Method formatElementChildren
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function formatElementChildren(ElementInterface $element, $indentStep = 1)
{
$indentLevel = $this->formatter->getLevel();
$this->formatter->setLevel($indentLevel + $indentStep);
$content = '';
Function isBlockTag
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function isBlockTag(MarkupInterface $element)
{
if ($element->belongsTo($this->getOption('inline_tags'))) {
return false;
}
- 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 yieldAssignmentElement
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function yieldAssignmentElement(AssignmentElement $element)
{
foreach ($this->getOption('assignment_handlers') as $handler) {
$iterator = $handler($element) ?: [];
- 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 __construct
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(Formatter $formatter = null)
{
parent::__construct($formatter);
$this
Method getDebugError
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDebugError($error, $code, $path = null)
{
/** @var \Throwable $error */
$line = $this->getSourceLine($error);
if ($line === false) {
Method formatKeywordElement
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function formatKeywordElement(KeywordElement $element)
{
$name = $element->getName();
$keyword = $this->getOption(['keywords', $name]);
$result = call_user_func($keyword, $element->getValue(), $element, $name);
Function isInFunctionParams
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function isInFunctionParams(&$tokens, $index)
{
$afterOpen = false;
for ($i = $index - 1; $i >= 0; $i--) {
if (in_array($tokens[$i], [')', '}'], true)) {
- 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
Consider simplifying this complex logical expression. Open
if (!$checked ||
$this->isInExclusionContext($tokens, $index) ||
$this->isInFunctionParams($tokens, $index) ||
$this->isInKeywordParams($tokens, $index) ||
$this->isInComplexInterpolation($tokens, $index) ||
Function hasDuplicateAttributeNames
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function hasDuplicateAttributeNames(MarkupInterface $element)
{
if ($element instanceof MarkupElement || $element instanceof MixinCallElement) {
$names = [];
foreach ($element->getAttributes() as $attribute) {
- 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 formatAttributes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function formatAttributes(MarkupElement $element)
{
if ($this->hasNonStaticAttributes($element) ||
$this->hasDuplicateAttributeNames($element)) {
$empty = true;
- 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 formatExpressionElement
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function formatExpressionElement(ExpressionElement $code)
{
$value = $this->formatCode($code->getValue(), $code->isChecked(), !$code->isTransformationAllowed());
if ($code->hasStaticValue()) {
- 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 __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$name,
$autoClosed = false,
SplObjectStorage $attributes = null,
ParserNode $originNode = null,
NodeInterface $parent = null,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$name,
SplObjectStorage $attributes = null,
AssignmentContainerInterface $container = null,
ParserNode $originNode = null,
NodeInterface $parent = null,
Consider simplifying this complex logical expression. Open
if ($nonEmptyAttribute && (
!$value ||
($value instanceof TextElement && ((string) $value->getValue()) === '') ||
(is_string($value) && in_array(trim($value), ['', '""', "''"], true))
)) {
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$name,
$value,
ParserNode $originNode = null,
NodeInterface $parent = null,
array $children = null