lib/LongitudeOne/Spatial/PHP/Types/AbstractMultiPolygon.php
Avoid using LongitudeOne\Spatial\PHP\Types\count() function in for loops. Open
Open
for ($i = 0; $i < count($this->polygons); ++$i) {
$polygons[] = $this->getPolygon($i);
}
- Read upRead up
- Exclude checks
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
Open
// TODO throw an error when $this->polygons is empty
- Exclude checks
TODO found Open
Open
// TODO throw an error when index is out of range
- Exclude checks
TODO found Open
Open
// TODO replace by a function to be compliant with -1, -2, etc.
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
Open
* @param ((float|int)[][]|LineStringInterface|MultiPointInterface|PointInterface[])[]|PolygonInterface $polygon polygon to add
- Exclude checks
Line exceeds 120 characters; contains 161 characters Open
Open
* @param null|int $srid Spatial Reference System Identifier
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
Open
* @param ((float|int)[][][]|LineStringInterface[]|MultiPointInterface[]|PointInterface[][]|PolygonInterface)[] $polygons polygons to set
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
Open
throw new InvalidValueException('AbstractMultiPolygon::addPolygon only accepts AbstractPolygon or an array as parameter');
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
Open
* @param ((float|int)[][][]|LineStringInterface[]|MultiPointInterface[]|PointInterface[][]|PolygonInterface)[] $polygons Polygons
- Exclude checks