Valdi\Validator\BeforeDateTime

class BeforeDateTime

Validator for a date time being before the given date time. For the format, see: http://php.net/manual/en/datetime.createfromformat.php

property type

protected

Holds the type of the validator.

property amountOfParameters

protected

Holds the amount of parameters.

property dateTimeParameters

protected

Holds whether to parse the parameters as DateTimes so the child class can decide.

isValidComparison(DateTime $date, $datetimes, $parameters)

{@inheritdoc}

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 parameters
  • $format (string) – the date time format
Returns:

DateTime[] the date times

isValid($value, $parameters)

{@inheritdoc}

Parameters:
  • $value
  • $parameters
getInvalidDetails()

{@inheritdoc}

validateParameterCount($name, $parameterAmount, $parameters)

Throws an exception if the parameters don’t fulfill the expected parameter count.

Parameters:
  • $name (string) – the name of the validator
  • $parameterAmount (integer) – the amount of expected parameters
  • $parameters (string[]) – the parameters