Showing 45 of 149 total issues
File Parser.php
has 1135 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Faf\TemplateEngine;
Function prepareNode
has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring. Open
protected function prepareNode(
DOMXPath $xPath,
HTML5DOMElement $domNode,
ParserElement $parserElement,
string $currentTagName
- 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
Parser
has 53 functions (exceeds 20 allowed). Consider refactoring. Open
class Parser extends BaseObject
{
public const ROOT = 'root';
public const MODE_PROD = 0;
Method prepareNode
has 171 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function prepareNode(
DOMXPath $xPath,
HTML5DOMElement $domNode,
ParserElement $parserElement,
string $currentTagName
Function loadAllowedChildElements
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
protected function loadAllowedChildElements(): array
{
$debugId = $this->debugStart('Load allowed child elements');
$key = 'fafte-allowed-child-elements-' . md5(implode('', array_keys($this->parserElements)));
$allowedChildElements = null;
- 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 parseElements
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
public function parseElements(string $string, string $currentTagName, bool $rawData = false)
{
$parentLanguage = $this->currentLanguage;
$this->currentLanguage = $this->getLanguage();
- 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 parseElements
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parseElements(string $string, string $currentTagName, bool $rawData = false)
{
$parentLanguage = $this->currentLanguage;
$this->currentLanguage = $this->getLanguage();
Function htmlTag
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function htmlTag(
string $name,
string $content = '',
?array $options = [],
string $attributePrefix = ''
- 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 getValue
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public static function &getValue(&$data, string $path, bool $callLastClosure = true)
{
static::checkForClosure($data);
$workData = $data;
- 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
ElementSetting
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class ElementSetting extends BaseObject
{
/**
* @var string
*/
ParserElement
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class ParserElement extends BaseObject
{
use TagTrait;
/**
Method elementSettings
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function elementSettings(): array
{
return [
new ElementSetting([
'name' => 'datetime',
Method elementSettings
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function elementSettings(): array
{
return [
new ElementSetting([
'name' => 'loop-each',
Method loadAllowedChildElements
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function loadAllowedChildElements(): array
{
$debugId = $this->debugStart('Load allowed child elements');
$key = 'fafte-allowed-child-elements-' . md5(implode('', array_keys($this->parserElements)));
$allowedChildElements = null;
Method getValue
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function &getValue(&$data, string $path, bool $callLastClosure = true)
{
static::checkForClosure($data);
$workData = $data;
Function getRawValue
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function &getRawValue($value)
{
if (is_array($value) || is_object($value)) {
return $value;
}
- 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 run
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run(): string
{
//TODO default settings from parser
//'machine_time_default_format', 'yyyy-MM-dd HH:mm:ss';
//'human_time_default_format', 'medium';
Method elementSettings
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function elementSettings(): array
{
return [
new ElementSetting([
'name' => 'string',
Method htmlTag
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function htmlTag(
string $name,
string $content = '',
?array $options = [],
string $attributePrefix = ''
Function formatParams
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function formatParams(array $rawParams, bool $setAttributeData, Parser $parser): array
{
$params = [];
foreach ($rawParams as $name => $value) {
- 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"