16 lines
401 B
PHP
16 lines
401 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
namespace App\Geometry;
|
|
|
|
final class Polygon
|
|
{
|
|
public static function validate(array $points): bool
|
|
{
|
|
if (count($points) < 3) return false;
|
|
foreach ($points as $pt) {
|
|
if (!is_array($pt) || count($pt) !== 2) return false;
|
|
if (!is_numeric($pt[0]) || !is_numeric($pt[1])) return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|