Showing 12 of 264 total issues
Function buildWithoutCache
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
public function buildWithoutCache(array $data): string
{
$code = [];
$lastLast = null;
$last = 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
File Flow.php
has 378 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Bavix\Flow;
use Bavix\Exceptions\Invalid;
Method buildWithoutCache
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildWithoutCache(array $data): string
{
$code = [];
$lastLast = null;
$last = null;
Flow
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class Flow
{
const VERSION = '1.0.6';
Method compile
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function compile(string $view): string
{
$path = $this->native()->path($view . $this->ext());
$this->tpl = \file_get_contents($path);
$tokens = $this->lexer()->tokens($this->tpl);
Method syntax
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function syntax(string $key, array $data)
{
foreach ($data['directives'] ?? [] as $_key => $directive)
{
$this->data($_key, $directive ?: []);
Method testExtends
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testExtends()
{
$codeWithoutComments = <<<code
<h1>{{ message }}</h1>
Method testComments
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testComments()
{
$code = <<<code
<!-- print message -->
Method testRaw
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testRaw()
{
$code = <<<code
{{ message }}
Consider simplifying this complex logical expression. Open
if ($last && (!$lastLast ||
($lastLast->type !== T_VARIABLE &&
$lastLast->type !== Validator::T_ENDBRACKET &&
$lastLast->type !== Validator::T_ENDARRAY))
&& $last->type === Validator::T_DOT)
Function compile
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function compile(string $view): string
{
$path = $this->native()->path($view . $this->ext());
$this->tpl = \file_get_contents($path);
$tokens = $this->lexer()->tokens($this->tpl);
- 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 loader
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function loader($file)
{
foreach ($this->folders as $folder)
{
foreach (FileLoader::extensions() as $ext)
- 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"