File Parser.php
has 652 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Kahlan\Jit;
use Kahlan\Jit\Node\NodeDef;
use Kahlan\Jit\Node\FunctionDef;
Function _parser
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
protected function _parser($content)
{
$this->_initLines($content);
$this->_stream = new TokenStream(['source' => $content, 'wrap' => $this->_states['php']]);
- 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 _parser
has 146 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _parser($content)
{
$this->_initLines($content);
$this->_stream = new TokenStream(['source' => $content, 'wrap' => $this->_states['php']]);
Parser
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class Parser
{
/**
* @var int
* @internal
Function _parseArgs
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function _parseArgs()
{
$cpt = 0;
$value = $name = '';
$args = [];
- 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 _useNode
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _useNode()
{
$current = $this->_states['current'];
$token = $this->_stream->current(true);
$last = $alias = $use = '';
Method _parseArgs
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _parseArgs()
{
$cpt = 0;
$value = $name = '';
$args = [];
Method _functionNode
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _functionNode()
{
$node = new FunctionDef();
$token = $this->_stream->current(true);
$parent = $this->_states['current'];
Method _classNode
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _classNode()
{
if (substr($this->_states['body'], -2) === '::') { // Bails out on `::class`
$this->_states['body'] .= 'class';
return;
Method debug
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function debug($content)
{
$root = is_object($content) ? $content : static::parse($content, ['lines' => true]);
$result = '';
Function _useNode
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function _useNode()
{
$current = $this->_states['current'];
$token = $this->_stream->current(true);
$last = $alias = $use = '';
- 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 _classNode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function _classNode()
{
if (substr($this->_states['body'], -2) === '::') { // Bails out on `::class`
$this->_states['body'] .= 'class';
return;
- 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 _annotationNode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function _annotationNode()
{
$cpt = 1; //because #[
$this->_codeNode();
$token = $this->_stream->current(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 _functionNode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function _functionNode()
{
$node = new FunctionDef();
$token = $this->_stream->current(true);
$parent = $this->_states['current'];
- 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 _normalizeClass
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function _normalizeClass($name)
{
if (!$name || $name[0] === '\\') {
return $name;
}
- 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"