PHP Класс Knp\Bundle\TimeBundle\DateTimeFormatter

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$translator

Открытые методы

Метод Описание
__construct ( Symfony\Component\Translation\TranslatorInterface $translator ) Constructor
formatDiff ( DateTimeInterface $from, DateTimeInterface $to ) : string Returns a formatted diff for the given from and to datetimes
getDiffMessage ( integer $count, boolean $invert, integer $unit ) : string Returns the diff message for the specified count and unit
getEmptyDiffMessage ( ) : string Returns the message for an empty diff

Защищенные методы

Метод Описание
doGetDiffMessage ( $count, $invert, $unit )

Описание методов

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

Constructor
public __construct ( Symfony\Component\Translation\TranslatorInterface $translator )
$translator Symfony\Component\Translation\TranslatorInterface Translator used for messages

doGetDiffMessage() защищенный Метод

protected doGetDiffMessage ( $count, $invert, $unit )

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

Returns a formatted diff for the given from and to datetimes
public formatDiff ( DateTimeInterface $from, DateTimeInterface $to ) : string
$from DateTimeInterface
$to DateTimeInterface
Результат string

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

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

Returns the message for an empty diff
public getEmptyDiffMessage ( ) : string
Результат string

Описание свойств

$translator защищенное свойство

protected $translator