Showing 20 of 29 total issues
Console
has 39 functions (exceeds 20 allowed). Consider refactoring. Open
class Console
{
const WEIGHT_HIGH = 300;
const WEIGHT_HIGHER = 250;
const WEIGHT_NORMAL = 200;
File Table.php
has 381 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Hugga\Output\Drawing;
use Hugga\Console;
File Console.php
has 341 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Hugga;
use Hugga\Input\Editline;
Function getRows
has a Cognitive Complexity of 28 (exceeds 9 allowed). Consider refactoring. Open
protected function getRows(iterable $data): array
{
$rows = [];
list($left, $right, $spacer) = $this->getDivider();
- 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
Table
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Table implements DrawingInterface
{
const CORNER_TOP_LEFT = 'ctl';
const CORNER_TOP_RIGHT = 'ctr';
const CORNER_BOTTOM_LEFT = 'cbl';
ProgressBar
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class ProgressBar implements DrawingInterface
{
protected static $formatDefinitions = [
'percentage' => '{percentage%3.0f}%',
'steps' => '{done}/{max}',
Method askInteractive
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function askInteractive(Console $console, Observer $observer)
{
/** @var InteractiveOutputInterface $output */
$output = $console->getOutput();
$maxVisible = $output->getSize()[0] - 2;
Method getRows
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getRows(iterable $data): array
{
$rows = [];
list($left, $right, $spacer) = $this->getDivider();
Method prepareColumns
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function prepareColumns()
{
if ($this->columns) {
return;
}
Function prepareColumns
has a Cognitive Complexity of 16 (exceeds 9 allowed). Consider refactoring. Open
protected function prepareColumns()
{
if ($this->columns) {
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
Method replaceFormatting
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function replaceFormatting(string $message, $strip = false)
{
$offset = 0;
$regEx = '/' . str_replace('()', '(' . $this->regexDefinition . ')', $this->regexTag) . '/';
$buffer = $message;
Method getText
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getText(): string
{
$this->prepareColumns();
$rows = [];
Function getEscapeSequence
has a Cognitive Complexity of 13 (exceeds 9 allowed). Consider refactoring. Open
protected function getEscapeSequence(string $def): string
{
if (strpos($def, ';') !== false) {
return implode('', array_map([$this, 'getEscapeSequence'], explode(';', $def)));
}
- 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 getText
has a Cognitive Complexity of 11 (exceeds 9 allowed). Consider refactoring. Open
public function getText(): string
{
$this->prepareColumns();
$rows = [];
- 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
Avoid too many return
statements within this method. Open
return $this->escape(static::$bgColors[$color]);
Avoid too many return
statements within this method. Open
return $this->escape("48;5;" . $color);
Avoid too many return
statements within this method. Open
return '';
Avoid too many return
statements within this method. Open
return $this->escape(static::$fgColors[$color]);
Avoid too many return
statements within this method. Open
return $this->escape(static::$fgColors[$def]);
Function replaceFormatting
has a Cognitive Complexity of 10 (exceeds 9 allowed). Consider refactoring. Open
protected function replaceFormatting(string $message, $strip = false)
{
$offset = 0;
$regEx = '/' . str_replace('()', '(' . $this->regexDefinition . ')', $this->regexTag) . '/';
$buffer = $message;
- 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"