Skip to content
Prev Previous commit
Next Next commit
Apply fixes from StyleCI
[ci skip] [skip ci]
  • Loading branch information
grimzy authored and StyleCIBot committed Mar 2, 2020
commit 5f72bd1e02c9b5aebc266d68c929e7b9e2f0f834
13 changes: 9 additions & 4 deletions src/Types/GeometryCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,27 +150,32 @@ public function jsonSerialize()
}

/**
* Checks
* Checks.
*
* @param array $items
*/
protected function validateItems(array $items) {
protected function validateItems(array $items)
{
$this->validateItemCount($items);

foreach ($items as $item) {
$this->validateItemType($item);
}
}

protected function validateItemCount(array $items) {
protected function validateItemCount(array $items)
{
if (count($items) < $this->minimumCollectionItems) {
$entries = $this->minimumCollectionItems === 1 ? 'entry' : 'entries';

throw new InvalidArgumentException(sprintf(
'%s must contain at least %d %s', get_class($this), $this->minimumCollectionItems, $entries
));
}
}

protected function validateItemType($item) {
protected function validateItemType($item)
{
if (!$item instanceof $this->collectionItemType) {
throw new InvalidArgumentException(sprintf(
'%s must be a collection of %s', get_class($this), $this->collectionItemType
Expand Down
1 change: 0 additions & 1 deletion src/Types/MultiLineString.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use GeoJson\GeoJson;
use GeoJson\Geometry\MultiLineString as GeoJsonMultiLineString;
use Grimzy\LaravelMysqlSpatial\Exceptions\InvalidGeoJsonException;
use InvalidArgumentException;

class MultiLineString extends GeometryCollection
{
Expand Down
1 change: 0 additions & 1 deletion src/Types/MultiPolygon.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use GeoJson\GeoJson;
use GeoJson\Geometry\MultiPolygon as GeoJsonMultiPolygon;
use Grimzy\LaravelMysqlSpatial\Exceptions\InvalidGeoJsonException;
use InvalidArgumentException;

class MultiPolygon extends GeometryCollection
{
Expand Down