Code Coverage
 
Classes and Traits
Functions and Methods
Lines
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
1
100.00% covered (success)
100.00%
1 / 1
<?php
namespace Verja\Validator;
/**
 * Validator\Before
 *
 * Validate that a datetime is before the given datetime.
 *
 * @WARNING Both values can be strings and will then be parsed by DateTime constructor. Use the DateTime filter before
 *          is highly recommended.
 *
 * @package Verja\Validator
 * @author  Thomas Flori <thflori@gmail.com>
 */
class Before extends TemporaAbstract
{
    protected $errorKey = 'NOT_BEFORE';
    protected $errorMessage = 'value should be before %s';
    protected function validateDateTime(\DateTime $value)
    {
        return $this->floatDiff($value, $this->dateTime) <= 0;
    }
}