AnnotationPoints
class AnnotationPoints implements ValidationRule
Properties
| protected Shape|null | $shape | The shape the points should be valid for. |
Methods
Create a new instance.
Get the validation error message for a points array.
Validate that all coordinates are either int or float.
Validate that the number of coordinates matches the required number for the given shape.
Validate that the number of points (sequential coordinate pairs) matches the expected number of points for the given shape.
Validate some edge cases where the given points don't create a valid shape.
Count the number of distinct points.
Details
at line 22
__construct(mixed $shape)
Create a new instance.
at line 36
void
validate(string $attribute, mixed $value, Closure $fail)
Run the validation rule.
at line 58
string|null
getErrorMessage(array $points)
Get the validation error message for a points array.
This can be used to apply the rule outside of a validator.
at line 75
protected string|null
validateCoordinatesAreNumeric(array $points)
Validate that all coordinates are either int or float.
at line 90
protected string|null
validateNumberOfCoordinates(array $points)
Validate that the number of coordinates matches the required number for the given shape.
at line 117
protected string|null
validateNumberOfPoints(array $points)
Validate that the number of points (sequential coordinate pairs) matches the expected number of points for the given shape.
at line 151
protected string|null
validateShape(array $points)
Validate some edge cases where the given points don't create a valid shape.
at line 189
protected int
countDistinctPoints(array $points)
Count the number of distinct points.