davaxi/Takuzu

View on GitHub

Showing 31 of 31 total issues

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.');
        }
Severity: Minor
Found in src/ResolverMethod/NecessaryValues.php - About 2 hrs to fix

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 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');
        }
Severity: Minor
Found in src/Resolver.php - About 2 hrs to fix

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.');
Severity: Minor
Found in src/Grid.php - About 1 hr to fix

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) {
Severity: Minor
Found in src/ResolverMethod/NoPossibleRange.php - About 1 hr to fix

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();
Severity: Minor
Found in src/ResolverSeriesGenerator.php - About 1 hr to fix

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');
        }
Severity: Minor
Found in src/Resolver.php - About 1 hr to fix

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);
Severity: Minor
Found in src/ResolverMethod/NecessaryValues.php - About 1 hr to fix

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;
Severity: Minor
Found in src/ResolverMethod/NoPossibleRange.php - About 1 hr to fix

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.');
Severity: Minor
Found in src/Grid.php - About 1 hr to fix

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();
Severity: Minor
Found in src/GridHelpers.php - About 1 hr to fix

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)) {
Severity: Minor
Found in src/Grid.php - About 55 mins to fix

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();
Severity: Minor
Found in src/ResolverSeriesGenerator.php - About 45 mins to fix

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();
Severity: Minor
Found in src/GridHelpers.php - About 45 mins to fix

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);
Severity: Minor
Found in src/ResolverMethod/NecessaryValues.php - About 45 mins to fix

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;
Severity: Minor
Found in src/GridChecker.php - About 45 mins to fix

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) {
Severity: Minor
Found in src/GridChecker.php - About 35 mins to fix

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]) {
Severity: Minor
Found in src/ResolverSeriesGenerator.php - About 35 mins to fix

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

Missing class import via use statement (line '89', column '23').
Open

            throw new \InvalidArgumentException('Expected value: ' . implode(', ', $allowedValues));
Severity: Minor
Found in src/GridChecker.php by phpmd

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();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '156', column '27').
Open

                throw new \LogicException('No change ?');
Severity: Minor
Found in src/Resolver.php by phpmd

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();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '286', column '23').
Open

            throw new \LogicException('Not exist empty case');
Severity: Minor
Found in src/Grid.php by phpmd

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();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Severity
Category
Status
Source
Language