Validator\YoungerThan¶
-
class
YoungerThan
¶ Validator for a date time being younger than a certain amount of seconds compared to the current moment. For the format, see: http://php.net/manual/en/datetime.createfromformat.php
-
property
dateTimeParameters
¶ protected
Holds whether to parse the parameters as DateTimes so the child class can decide.
-
property
type
¶ protected
Holds the type of the validator.
-
property
amountOfParameters
¶ protected
Holds the amount of parameters.
-
isValidComparison
(DateTime $date, $datetimes, $parameters)¶ -
Parameters: - $date (DateTime) –
- $datetimes –
- $parameters –
-
getDateTimeFormat
($parameters)¶ Gets a date time format from the parameters if given or a default one.
Parameters: - $parameters (string[]) – the parameters
Returns: string the date time format
-
getDateTimes
($parameters, $format)¶ Interprets the given parameters as date times and returns them.
Parameters: - $parameters (array) – the paramters
- $format (string) – the date time format
Returns: DateTime[] the date times
-
isValid
($value, $parameters)¶ -
Parameters: - $value –
- $parameters –
-
getInvalidDetails
()¶
-
validateParameterCount
($name, $parameterAmount, $parameters)¶ Throws an exception if the parameters don’t fullfill the expected parameter count.
Parameters: - $name (string) – the name of the validator
- $parameterAmount (integer) – the amount of expected parameters
- $parameters (string[]) – the parameters
-
property