Showing 179 of 179 total issues
File Parser.php
has 393 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace JsPhpize\Parser;
use JsPhpize\JsPhpize;
Function appendFunctionsCalls
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
protected function appendFunctionsCalls(&$value, $previousToken = null, $applicant = null)
{
while ($token = $this->get(0)) {
if ($token->is('{') || $token->expectNoLeftMember()) {
throw $this->unexpected($this->next());
- 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 parseParentheses
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
protected function parseParentheses($allowedSeparators = [',', ';'])
{
$parentheses = new Parenthesis();
$exceptionInfos = $this->exceptionInfos();
$expectComma = 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
File Compiler.php
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace JsPhpize\Compiler;
use JsPhpize\JsPhpize;
The class Parser has an overall complexity of 107 which is very high. The configured complexity threshold is 50. Open
class Parser extends TokenExtractor
{
/**
* @var JsPhpize
*/
- Exclude checks
The class Scanner has 11 public methods. Consider refactoring Scanner to keep number of public methods under 10. Open
class Scanner
{
public function scanUnexpected($matches)
{
throw $this->unexpected($this->valueToken('token', $matches));
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
The class Compiler has an overall complexity of 75 which is very high. The configured complexity threshold is 50. Open
class Compiler
{
const DOT_DISABLED = 1;
use DyiadeTrait;
- Exclude checks
The class TokenExtractor has an overall complexity of 55 which is very high. The configured complexity threshold is 50. Open
abstract class TokenExtractor extends TokenCrawler
{
protected function getBracketsArrayItemKeyFromToken($token)
{
$typeAndValue = new BracketsArrayItemKey($token);
- Exclude checks
Function parseVariable
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected function parseVariable($name)
{
$children = [];
$variable = 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
Method appendFunctionsCalls
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function appendFunctionsCalls(&$value, $previousToken = null, $applicant = null)
{
while ($token = $this->get(0)) {
if ($token->is('{') || $token->expectNoLeftMember()) {
throw $this->unexpected($this->next());
Method render
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render($input, $filename = null, array $variables = [])
{
if (is_array($filename)) {
$variables = $filename;
$filename = null;
Method parseParentheses
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function parseParentheses($allowedSeparators = [',', ';'])
{
$parentheses = new Parenthesis();
$exceptionInfos = $this->exceptionInfos();
$expectComma = false;
Function parseHooksArray
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function parseHooksArray()
{
$array = new HooksArray();
$exceptionInfos = $this->exceptionInfos();
$expectComma = 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 parseBracketsArray
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function parseBracketsArray()
{
$array = new BracketsArray();
$exceptionInfos = $this->exceptionInfos();
$expectComma = 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 visitDyiade
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function visitDyiade(Dyiade $dyiade, $indent)
{
$leftHand = $this->visitNode($dyiade->leftHand, $indent);
$rightHand = $this->visitNode($dyiade->rightHand, $indent);
switch ($dyiade->operator) {
Method parseKeywordStatement
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function parseKeywordStatement($token)
{
$name = $token->value;
$keyword = new Block($name);
Method parseVariable
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function parseVariable($name)
{
$children = [];
$variable = null;
Function visitDyiade
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function visitDyiade(Dyiade $dyiade, $indent)
{
$leftHand = $this->visitNode($dyiade->leftHand, $indent);
$rightHand = $this->visitNode($dyiade->rightHand, $indent);
switch ($dyiade->operator) {
- 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 parseInstruction
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function parseInstruction($block, $token, &$initNext)
{
if ($token->type === 'keyword') {
if ($token->isIn('var', 'const')) {
$initNext = 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 render
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function render($input, $filename = null, array $variables = [])
{
if (is_array($filename)) {
$variables = $filename;
$filename = 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"