Showing 35 of 35 total issues
File DebuggerTrait.php
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Phug\Renderer\Partial\Debug;
use Phug\Formatter;
File ProfilerModule.php
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Phug\Renderer\Profiler;
use Phug\Compiler\Event\CompileEvent;
Function scanDirectory
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function scanDirectory($directory, $extensions = null, $directoryCallback = null, $fileCallback = null)
{
if ($extensions === null) {
$extensions = $this->getOption('extensions');
}
- 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
ProfilerModule
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class ProfilerModule extends AbstractModule
{
/**
* @var int
*/
Function getExposedProperties
has a Cognitive Complexity of 18 (exceeds 5 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
Function getErrorMessage
has a Cognitive Complexity of 16 (exceeds 5 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
File FileAdapter.php
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Phug\Renderer\Adapter;
use Phug\Compiler\LocatorInterface;
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 initProperties
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function initProperties($name, $events)
{
$style = [];
foreach ([
['current', EndLexEvent::class, 'lexing', [
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
Function compose
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function compose($timePrecision, $lineHeight)
{
$duration = microtime(true) - $this->startTime;
$linkedProcesses = new LinkedProcesses($this->events, $this->nodesRegister);
- 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 handleError
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function handleError($error, $code, $path, $source, $parameters, $options)
{
/* @var \Throwable $error */
$exception = $options['debug']
? $this->getDebuggedException($error, $code, $source, $path, $parameters, $options)
- 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 getEventListeners
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getEventListeners()
{
$eventListeners = array_map(function (callable $eventListener) {
return function (Event $event) use ($eventListener) {
if ($this->isAlive() && $eventListener($event) !== false) {
Method renderDirectory
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderDirectory($path, $destination = null, $extension = '.html', array $parameters = [])
{
if (is_array($destination)) {
$parameters = $destination;
$destination = null;
Method getExposedProperties
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getExposedProperties($object, $deep)
{
$result = "\n";
foreach (get_class_methods($object) as $method) {
if (mb_strlen($result) > 0x80000) {
Method getDefaultOptions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getDefaultOptions($options)
{
return [
'debug' => true,
'exit_on_error' => true,
Function calculateIndex
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function calculateIndex($lines, $min, $max)
{
$index = 0;
foreach ($lines as $level => $line) {
foreach ($line as $process) {
- 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 __construct
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(EventList $events, SplObjectStorage $nodesRegister)
{
$this->nodesRegister = $nodesRegister;
if ($events) {
- 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 enableModules
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function enableModules()
{
/* @var ModuleContainerInterface $this */
$this->addModules($this->getOption('modules'));