Knp\Bundle\TimeBundle\DateTimeFormatter::getDiffMessage PHP Метод

getDiffMessage() публичный Метод

Returns the diff message for the specified count and unit
public getDiffMessage ( integer $count, boolean $invert, integer $unit ) : string
$count integer The diff count
$invert boolean Whether to invert the count
$unit integer The unit must be either year, month, day, hour, minute or second
Результат string
    public function getDiffMessage($count, $invert, $unit)
    {
        if (0 === $count) {
            throw new \InvalidArgumentException('The count must not be null.');
        }
        $unit = strtolower($unit);
        if (!in_array($unit, array('year', 'month', 'day', 'hour', 'minute', 'second'))) {
            throw new \InvalidArgumentException(sprintf('The unit \'%s\' is not supported.', $unit));
        }
        return $this->doGetDiffMessage($count, $invert, $unit);
    }