Twig_Extensions_Extension_Date
extends Twig_Extension
in package
Tags
Table of Contents
- $units : mixed
- $translator : TranslatorInterface
- __construct() : mixed
- diff() : string
- Filter for converting dates to a time ago string like Facebook and Twitter has.
- getFilters() : mixed
- {@inheritdoc}
- getFunctions() : array<string|int, TwigFunction>
- Returns a list of functions to add to the existing list.
- getName() : mixed
- {@inheritdoc}
- getNodeVisitors() : array<string|int, NodeVisitorInterface>
- Returns the node visitor instances to add to the existing list.
- getOperators() : array<string|int, array<string|int, mixed>>
- Returns a list of operators to add to the existing list.
- getTests() : array<string|int, TwigTest>
- Returns a list of tests to add to the existing list.
- getTokenParsers() : array<string|int, TokenParserInterface>
- Returns the token parser instances to add to the existing list.
- getPluralizedInterval() : mixed
Properties
$units
public
static mixed
$units
= array('y' => 'year', 'm' => 'month', 'd' => 'day', 'h' => 'hour', 'i' => 'minute', 's' => 'second')
$translator
private
TranslatorInterface
$translator
Methods
__construct()
public
__construct([TranslatorInterface $translator = null ]) : mixed
Parameters
- $translator : TranslatorInterface = null
Return values
mixed —diff()
Filter for converting dates to a time ago string like Facebook and Twitter has.
public
diff(Twig_Environment $env, string|DateTime $date[, string|DateTime $now = null ]) : string
Parameters
- $env : Twig_Environment
-
a Twig_Environment instance
- $date : string|DateTime
-
a string or DateTime object to convert
- $now : string|DateTime = null
-
A string or DateTime object to compare with. If none given, the current time will be used.
Return values
string —the converted time
getFilters()
{@inheritdoc}
public
getFilters() : mixed
Return values
mixed —getFunctions()
Returns a list of functions to add to the existing list.
public
getFunctions() : array<string|int, TwigFunction>
Return values
array<string|int, TwigFunction> —getName()
{@inheritdoc}
public
getName() : mixed
Return values
mixed —getNodeVisitors()
Returns the node visitor instances to add to the existing list.
public
getNodeVisitors() : array<string|int, NodeVisitorInterface>
Return values
array<string|int, NodeVisitorInterface> —getOperators()
Returns a list of operators to add to the existing list.
public
getOperators() : array<string|int, array<string|int, mixed>>
Return values
array<string|int, array<string|int, mixed>> —First array of unary operators, second array of binary operators
getTests()
Returns a list of tests to add to the existing list.
public
getTests() : array<string|int, TwigTest>
Return values
array<string|int, TwigTest> —getTokenParsers()
Returns the token parser instances to add to the existing list.
public
getTokenParsers() : array<string|int, TokenParserInterface>
Return values
array<string|int, TokenParserInterface> —getPluralizedInterval()
protected
getPluralizedInterval(mixed $count, mixed $invert, mixed $unit) : mixed
Parameters
- $count : mixed
- $invert : mixed
- $unit : mixed