Validator\InThePast

class InThePast

Validator for a date time being in the past compared to the current moment. For the format, see: http://php.net/manual/en/datetime.createfromformat.php

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.

property type

protected

Holds the type of the validator.

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 paramters
  • $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 fullfill the expected parameter count.

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