Showing 113 of 115 total issues
Method __construct
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(Formatter $formatter = null)
{
$this->setOptionsRecursive([
'white_space_sensitive_tags' => [
'pre',
Function removeOptions
has a Cognitive Complexity of 19 (exceeds 7 allowed). Consider refactoring. Open
public static function removeOptions($path, $options)
{
if (self::$renderer && (empty($path) || self::$renderer->hasOption($path))) {
if (is_array($options)) {
foreach ($options as $key => $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
Function handleTokens
has a Cognitive Complexity of 19 (exceeds 7 allowed). Consider refactoring. Open
protected function handleTokens($code, $checked)
{
$phpTokenHandler = $this->getOption('php_token_handlers');
$untouched = 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
Method isInExclusionContext
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function isInExclusionContext(&$tokens, $index)
{
foreach ([
// Exclude tokens before the variables
-1 => [
Method parse
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parse($input, $path = null)
{
$stateClassName = $this->getOption('parser_state_class_name');
$event = new ParseEvent($input, $path, $stateClassName, [
Function formatAttributeElement
has a Cognitive Complexity of 18 (exceeds 7 allowed). Consider refactoring. Open
protected function formatAttributeElement(AttributeElement $element)
{
$value = $element->getValue();
$name = $element->getName();
$nonEmptyAttribute = ($name === 'class' || $name === 'id');
- 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 getExposedProperties
has a Cognitive Complexity of 18 (exceeds 7 allowed). Consider refactoring. Open
private function getExposedProperties($object, $deep)
{
$result = "\n";
foreach (get_class_methods($object) as $method) {
if (mb_strlen($result) > 0x80000) {
- 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 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($options = null)
{
$this->initFormats()->setOptionsDefaults($options ?: [], [
'debug' => false,
'located_exception_class_name' => LocatedException::class,
Method getErrorMessage
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getErrorMessage($error, SourceLocation $location, $data)
{
/* @var \Throwable $error */
$source = explode("\n", rtrim($data->source));
$errorType = get_class($error);
Method compose
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function compose($timePrecision, $lineHeight)
{
$duration = microtime(true) - $this->startTime;
$linkedProcesses = new LinkedProcesses($this->events, $this->nodesRegister);
Method formatAttributeElement
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function formatAttributeElement(AttributeElement $element)
{
$value = $element->getValue();
$name = $element->getName();
$nonEmptyAttribute = ($name === 'class' || $name === 'id');
Method readExpression
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function readExpression(array $breaks = null, array $brackets = null)
{
if (!$this->hasLength()) {
return;
}
Function scan
has a Cognitive Complexity of 17 (exceeds 7 allowed). Consider refactoring. Open
public function scan(State $state)
{
$reader = $state->getReader();
if ($reader->match('(?<raw>\!)?#\{')) {
- 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 displayFile
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function displayFile($__pug_file, array $__pug_parameters = [])
{
if ($this->isExpired($__pug_file, $__pug_cache_file)) {
if (isset($this->options['render'])) {
call_user_func($this->options['render'], $__pug_file, $__pug_parameters, $this->options);
Function getErrorMessage
has a Cognitive Complexity of 16 (exceeds 7 allowed). Consider refactoring. Open
private function getErrorMessage($error, SourceLocation $location, $data)
{
/* @var \Throwable $error */
$source = explode("\n", rtrim($data->source));
$errorType = get_class($error);
- 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 initProperties
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function initProperties($name, $events)
{
$style = [];
foreach ([
['current', EndLexEvent::class, 'lexing', [
Method getSourceLine
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getSourceLine($error)
{
$previous = null;
$line = null;
Method handleTokens
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function handleTokens($code, $checked)
{
$phpTokenHandler = $this->getOption('php_token_handlers');
$untouched = false;
Method addModule
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addModule($module)
{
if ($module instanceof ModuleInterface) {
if (in_array($module, $this->modules, true)) {
throw new InvalidArgumentException(
Method initDebugOptions
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function initDebugOptions(Renderer $profilerContainer)
{
$profilerContainer->setOptionsDefaults([
'memory_limit' => $profilerContainer->getOption('debug') ? 0x3200000 : -1, // 50MB by default in debug
'execution_max_time' => $profilerContainer->getOption('debug') ? 30000 : -1, // 30s by default in debug