class VideoAnnotationPoints extends AnnotationPoints

Properties

protected int|null $shapeId

ID of the shape the points should be valid for.

from  AnnotationPoints

Methods

__construct(mixed $shapeId)

Create a new instance.

void
validate(string $attribute, mixed $value, Closure $fail)

Run the validation rule.

string|null
getErrorMessage(array $points)

Get the validation error message for a points array.

string|null
validateCoordinatesAreNumeric(array $points)

Validate that all coordinates are either int or float.

string|null
validateNumberOfCoordinates(array $points)

Validate that the number of coordinates matches the required number for the given shape.

string|null
validateNumberOfPoints(array $points)

Validate that the number of points (sequential coordinate pairs) matches the expected number of points for the given shape.

string|null
validateShape(array $points)

Validate some edge cases where the given points don't create a valid shape.

int
countDistinctPoints(array $points)

Count the number of distinct points.

string|null
validatePointsStructure(array $points)

Validate the structure of the points array.

string|null
validatePointsPerKeyFrame(array $points)

Validate the shape-specific requirements of the points of each key frame.

Details

in AnnotationPoints at line 22
__construct(mixed $shapeId)

Create a new instance.

Parameters

mixed $shapeId

Shape ID. Anything that is not a number is treated as unknown shape, in which case the points are not validated.

in AnnotationPoints at line 30
void validate(string $attribute, mixed $value, Closure $fail)

Run the validation rule.

Parameters

string $attribute
mixed $value
Closure $fail

Return Value

void

at line 15
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.

Parameters

array $points

Points array like [x1, y1, x2, y2, x3, y3, ...]

Return Value

string|null

The error message or null if the points are valid.

in AnnotationPoints at line 69
protected string|null validateCoordinatesAreNumeric(array $points)

Validate that all coordinates are either int or float.

Parameters

array $points

Return Value

string|null

in AnnotationPoints at line 84
protected string|null validateNumberOfCoordinates(array $points)

Validate that the number of coordinates matches the required number for the given shape.

Parameters

array $points

Return Value

string|null

in AnnotationPoints at line 111
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.

Parameters

array $points

Return Value

string|null

in AnnotationPoints at line 145
protected string|null validateShape(array $points)

Validate some edge cases where the given points don't create a valid shape.

Parameters

array $points

Return Value

string|null

in AnnotationPoints at line 183
protected int countDistinctPoints(array $points)

Count the number of distinct points.

Parameters

array $points

Return Value

int

at line 34
protected string|null validatePointsStructure(array $points)

Validate the structure of the points array.

Parameters

array $points

Return Value

string|null

at line 54
protected string|null validatePointsPerKeyFrame(array $points)

Validate the shape-specific requirements of the points of each key frame.

Parameters

array $points

Return Value

string|null