Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
Before
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 validateDateTime
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Verja\Validator;
4
5/**
6 * Validator\Before
7 *
8 * Validate that a datetime is before the given datetime.
9 *
10 * @WARNING Both values can be strings and will then be parsed by DateTime constructor. Use the DateTime filter before
11 *          is highly recommended.
12 *
13 * @package Verja\Validator
14 * @author  Thomas Flori <thflori@gmail.com>
15 */
16class Before extends TemporaAbstract
17{
18    protected $errorKey = 'NOT_BEFORE';
19    protected $errorMessage = 'value should be before %s';
20
21    protected function validateDateTime(\DateTime $value)
22    {
23        return $this->floatDiff($value, $this->dateTime) <= 0;
24    }
25}