longitude-one/doctrine-spatial

View on GitHub
lib/LongitudeOne/Spatial/PHP/Types/AbstractMultiPolygon.php

Summary

Maintainability
A
0 mins
Test Coverage
A
96%

Avoid using LongitudeOne\Spatial\PHP\Types\count() function in for loops.
Open

        for ($i = 0; $i < count($this->polygons); ++$i) {
            $polygons[] = $this->getPolygon($i);
        }

CountInLoopExpression

Since: 2.7.0

Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.

Example

class Foo {

  public function bar()
  {
    $array = array();

    for ($i = 0; count($array); $i++) {
      // ...
    }
  }
}

Source https://phpmd.org/rules/design.html#countinloopexpression

TODO found
Open

        // TODO throw an error when $this->polygons is empty

TODO found
Open

        // TODO throw an error when index is out of range

TODO found
Open

        // TODO replace by a function to be compliant with -1, -2, etc.

Line exceeds 120 characters; contains 131 characters
Open

     * @param ((float|int)[][]|LineStringInterface|MultiPointInterface|PointInterface[])[]|PolygonInterface $polygon polygon to add

Line exceeds 120 characters; contains 161 characters
Open

     * @param null|int                                                                                              $srid     Spatial Reference System Identifier

Line exceeds 120 characters; contains 141 characters
Open

     * @param ((float|int)[][][]|LineStringInterface[]|MultiPointInterface[]|PointInterface[][]|PolygonInterface)[] $polygons polygons to set

Line exceeds 120 characters; contains 134 characters
Open

            throw new InvalidValueException('AbstractMultiPolygon::addPolygon only accepts AbstractPolygon or an array as parameter');

Line exceeds 120 characters; contains 134 characters
Open

     * @param ((float|int)[][][]|LineStringInterface[]|MultiPointInterface[]|PointInterface[][]|PolygonInterface)[] $polygons Polygons

There are no issues that match your filters.

Category
Status