PHP 클래스 Salavert\Twig\Extension\TimeAgoExtension

상속: extends Twig_Extension
파일 보기 프로젝트 열기: salavert/time-ago-in-words 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$translator Symfony\Component\Translation\TranslatorInterface

공개 메소드들

메소드 설명
__construct ( Symfony\Component\Translation\TranslatorInterface $translator ) Constructor method
distanceOfTimeInWordsFilter ( string | DateTime $from_time, string | DateTime $to_time = null, boolean $include_seconds = false, boolean $include_months = false ) : string Reports the approximate distance in time between two times given in seconds or in a valid ISO string like.
getFilters ( )
getName ( ) : string Returns the name of the extension.
timeAgoInWordsFilter ( $from_time, boolean $include_seconds = false, boolean $include_months = false ) : mixed Like distance_of_time_in_words, but where to_time is fixed to timestamp()

비공개 메소드들

메소드 설명
future ( integer $distance_in_minutes, boolean $include_seconds, $distance_in_seconds ) : mixed

메소드 상세

__construct() 공개 메소드

Constructor method
public __construct ( Symfony\Component\Translation\TranslatorInterface $translator )
$translator Symfony\Component\Translation\TranslatorInterface

distanceOfTimeInWordsFilter() 공개 메소드

For example, if the distance is 47 minutes, it'll return "about 1 hour". See the source for the complete wording list. Integers are interpreted as seconds. So, by example to check the distance of time between a created user and their last login: {{ user.createdAt|distance_of_time_in_words(user.lastLoginAt) }} returns "less than a minute". Set include_seconds to true if you want more detailed approximations if distance < 1 minute Set include_months to true if you want approximations in months if days > 30
public distanceOfTimeInWordsFilter ( string | DateTime $from_time, string | DateTime $to_time = null, boolean $include_seconds = false, boolean $include_months = false ) : string
$from_time string | DateTime
$to_time string | DateTime
$include_seconds boolean True to return distance in seconds when it's lower than a minute.
$include_months boolean
리턴 string

getFilters() 공개 메소드

public getFilters ( )

getName() 공개 메소드

Returns the name of the extension.
public getName ( ) : string
리턴 string The extension name

timeAgoInWordsFilter() 공개 메소드

Like distance_of_time_in_words, but where to_time is fixed to timestamp()
public timeAgoInWordsFilter ( $from_time, boolean $include_seconds = false, boolean $include_months = false ) : mixed
$from_time String or DateTime
$include_seconds boolean
$include_months boolean
리턴 mixed

프로퍼티 상세

$translator 보호되어 있는 프로퍼티

protected TranslatorInterface,Symfony\Component\Translation $translator
리턴 Symfony\Component\Translation\TranslatorInterface