Showing 31 of 31 total issues
Function nextResolveSteps
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function nextResolveSteps()
{
if ($this->resolved) {
throw new \LogicException('Grid already resolved');
}
- Read upRead up
- Create a ticketCreate a ticket
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 checkExistNecessaryValues
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function checkExistNecessaryValues(array &$needValues, array &$undefinedRanges)
{
if ($needValues[Grid::ZERO] < 0 || $needValues[Grid::ONE] < 0) {
throw new InvalidGridException('Grid line not to be resolved.');
}
- Read upRead up
- Create a ticketCreate a ticket
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 setGridFromArray
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function setGridFromArray(array $grid)
{
$lineCount = count($grid);
if ($lineCount % 2 !== 0) {
throw new \InvalidArgumentException('The grid should have an even number line.');
- Read upRead up
- Create a ticketCreate a ticket
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 getPositionFromPossibilities
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected static function getPositionFromPossibilities(array $possibilities, $minPosition, $maxPosition)
{
$positions = array_fill($minPosition, $maxPosition - $minPosition + 1, null);
foreach ($possibilities as $possibility) {
foreach ($possibility as $positionNo => $value) {
- Read upRead up
- Create a ticketCreate a ticket
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 getRangePossibilities
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getRangePossibilities(array $needs, $leftValues = array(), $rightValues = array())
{
$rangeLength = array_sum($needs);
if (!$rangeLength) {
return array();
- Create a ticketCreate a ticket
Method nextResolveSteps
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function nextResolveSteps()
{
if ($this->resolved) {
throw new \LogicException('Grid already resolved');
}
- Create a ticketCreate a ticket
Method foundOnGridLine
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function foundOnGridLine(array $line)
{
$count = count($line);
$needValues = static::$helpers->getMissingLineValueDistribution($line);
$undefinedRanges = static::$helpers->getUndefinedRangeLine($line);
- Create a ticketCreate a ticket
Method foundOnGridLine
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function foundOnGridLine(array $line)
{
$undefinedRanges = static::$helpers->getUndefinedRangeLine($line);
if (count($undefinedRanges) !== 1) {
return false;
- Create a ticketCreate a ticket
Method setGridFromArray
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setGridFromArray(array $grid)
{
$lineCount = count($grid);
if ($lineCount % 2 !== 0) {
throw new \InvalidArgumentException('The grid should have an even number line.');
- Create a ticketCreate a ticket
Method getUndefinedRangeLine
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getUndefinedRangeLine(array $line)
{
$valuesPositions = static::getUndefinedLinePositions($line);
$ranges = array();
- Create a ticketCreate a ticket
Function __construct
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($width = null, $height = null)
{
$this->checker = new GridChecker($this);
$this->helpers = new GridHelpers();
if (!is_null($width) && !is_null($height)) {
- Read upRead up
- Create a ticketCreate a ticket
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 getUndefinedRangeLine
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function getUndefinedRangeLine(array $line)
{
$valuesPositions = static::getUndefinedLinePositions($line);
$ranges = array();
- Read upRead up
- Create a ticketCreate a ticket
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 checkLines
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function checkLines(array &$lines)
{
foreach ($lines as $line) {
if (!$this->checkLineValuesDefined($line)) {
return false;
- Read upRead up
- Create a ticketCreate a ticket
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 getRangePossibilities
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function getRangePossibilities(array $needs, $leftValues = array(), $rightValues = array())
{
$rangeLength = array_sum($needs);
if (!$rangeLength) {
return array();
- Read upRead up
- Create a ticketCreate a ticket
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 foundOnGridLine
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function foundOnGridLine(array $line)
{
$count = count($line);
$needValues = static::$helpers->getMissingLineValueDistribution($line);
$undefinedRanges = static::$helpers->getUndefinedRangeLine($line);
- Read upRead up
- Create a ticketCreate a ticket
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 getPossibilities
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected static function getPossibilities(array $possibility)
{
$possibilities = array();
foreach (static::$values as $value) {
if (!$possibility['needs'][$value]) {
- Read upRead up
- Create a ticketCreate a ticket
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 checkLineValuesEqualities
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function checkLineValuesEqualities(array $line)
{
$equality = 0;
foreach ($line as $value) {
if ($value === Grid::ZERO) {
- Read upRead up
- Create a ticketCreate a ticket
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 true;
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return true;
- Create a ticketCreate a ticket
Missing class import via use statement (line '133', column '23'). Open
throw new \InvalidArgumentException('The grid should have an even number line.');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}