|
Jobbuddy
|
Fonctions membres publiques | |
| setDateFormat ($format=null, $dateIntervalFormat=null) | |
| getDateFormat () | |
| setTimezone ($timezone) | |
| getTimezone () | |
| setNumberFormat ($decimal, $decimalPoint, $thousandSep) | |
| getNumberFormat () | |
| getTokenParsers () | |
| getFilters () | |
| getFunctions () | |
| getTests () | |
| getNodeVisitors () | |
| getExpressionParsers () | |
| formatDate ($date, $format=null, $timezone=null) | |
| modifyDate ($date, $modifier) | |
| convertDate ($date=null, $timezone=null) | |
| formatNumber ($number, $decimal=null, $decimalPoint=null, $thousandSep=null) | |
| Fonctions membres publiques hérités de AbstractExtension | |
| getOperators () | |
| getLastModified () | |
Fonctions membres publiques statiques | |
| static | cycle ($values, $position) |
| static | random (string $charset, $values=null, $max=null) |
| static | sprintf ($format,... $values) |
| static | dateConverter (Environment $env, $date, $format=null, $timezone=null) |
| static | replace ($str, $from) |
| static | round ($value, $precision=0, $method='common') |
| static | urlencode ($url) |
| static | merge (... $arrays) |
| static | slice (string $charset, $item, $start, $length=null, $preserveKeys=false) |
| static | first (string $charset, $item) |
| static | last (string $charset, $item) |
| static | join ($value, $glue='', $and=null) |
| static | split (string $charset, $value, $delimiter, $limit=null) |
| static | default ($value, $default='') |
| static | keys ($array) |
| static | invoke (\Closure $arrow,... $arguments) |
| static | reverse (string $charset, $item, $preserveKeys=false) |
| static | shuffle (string $charset, $item) |
| static | sort (Environment $env, $array, $arrow=null) |
| static | inFilter ($value, $compare) |
| static | compare ($a, $b) |
| static | matches (string $regexp, ?string $str) |
| static | trim ($string, $characterMask=null, $side='both') |
| static | nl2br ($string) |
| static | spaceless ($content) |
| static | convertEncoding ($string, $to, $from) |
| static | length (string $charset, $thing) |
| static | upper (string $charset, $string) |
| static | lower (string $charset, $string) |
| static | striptags ($string, $allowable_tags=null) |
| static | titleCase (string $charset, $string) |
| static | capitalize (string $charset, $string) |
| static | callMacro (Template $template, string $method, array $args, int $lineno, array $context, Source $source) |
| static | ensureTraversable ($seq) |
| static | toArray ($seq, $preserveKeys=true) |
| static | testEmpty ($value) |
| static | testSequence ($value) |
| static | testMapping ($value) |
Champs de données | |
| const | ARRAY_LIKE_CLASSES |
Attributs publics statiques | |
| static | function |
| static | $context |
| static | $template |
| static | $variables = [] |
| static | $withContext = true |
| static | $ignoreMissing = false |
|
static |
Returns a capitalized string.
| string | null | $string | A string |
|
static |
Compares two values using a more strict version of the PHP non-strict comparison operator.
| convertDate | ( | $date = null, | |
| $timezone = null ) |
Converts an input to a \DateTime instance.
{% if date(user.created_at) < date('+2days') %} {# do something #} {% endif %}
| \DateTimeInterface | string | int | null | $date | A date, a timestamp or null to use the current time |
| \DateTimeZone | string | false | null | $timezone | The target timezone, null to use the default, false to leave unchanged |
|
static |
| string | null | $string | |
| string | $to | |
| string | $from |
|
static |
Cycles over a sequence.
| array | \ArrayAccess | $values | A non-empty sequence of values |
| int<0,max> | $position The position of the value to return in the cycle |
|
static |
@template TSequence
| TSequence | $seq |
|
static |
Returns the first element of the item.
| mixed | $item | A variable |
| formatDate | ( | $date, | |
| $format = null, | |||
| $timezone = null ) |
Formats a date.
{{ post.published_at|date("m/d/Y") }}
| \DateTimeInterface | \DateInterval | string | int | null | $date | A date, a timestamp or null to use the current time |
| string | null | $format | The target format, null to use the default |
| \DateTimeZone | string | false | null | $timezone | The target timezone, null to use the default, false to leave unchanged |
| formatNumber | ( | $number, | |
| $decimal = null, | |||
| $decimalPoint = null, | |||
| $thousandSep = null ) |
Formats a number.
All of the formatting options can be left null, in that case the defaults will be used. Supplying any of the parameters will override the defaults set in the environment object.
| mixed | $number | A float/int/string of the number to format |
| int | null | $decimal | the number of decimal points to display |
| string | null | $decimalPoint | the character(s) to use for the decimal point |
| string | null | $thousandSep | the character(s) to use for the thousands separator |
| getDateFormat | ( | ) |
Gets the default format to be used by the date filter.
| getExpressionParsers | ( | ) |
Réimplémentée à partir de AbstractExtension.
| getFilters | ( | ) |
Returns a list of filters to add to the existing list.
Réimplémentée à partir de AbstractExtension.
| getFunctions | ( | ) |
Returns a list of functions to add to the existing list.
Réimplémentée à partir de AbstractExtension.
| getNodeVisitors | ( | ) |
Returns the node visitor instances to add to the existing list.
Réimplémentée à partir de AbstractExtension.
| getNumberFormat | ( | ) |
Get the default format used by the number_format filter.
| getTests | ( | ) |
Returns a list of tests to add to the existing list.
Réimplémentée à partir de AbstractExtension.
| getTimezone | ( | ) |
Gets the default timezone to be used by the date filter.
| getTokenParsers | ( | ) |
Returns the token parser instances to add to the existing list.
Réimplémentée à partir de AbstractExtension.
|
static |
Invokes a callable.
|
static |
Joins the values to a string.
The separators between elements are empty strings per default, you can define them with the optional parameters.
{{ [1, 2, 3]|join(', ', ' and ') }} {# returns 1, 2 and 3 #}
{{ [1, 2, 3]|join('|') }} {# returns 1|2|3 #}
{{ [1, 2, 3]|join }} {# returns 123 #}
| iterable | array | string | float | int | bool | null | $value | An array |
| string | $glue | The separator |
| string | null | $and | The separator for the last pair |
|
static |
Returns the keys for the given array.
It is useful when you want to iterate over the keys of an array:
{% for key in array|keys %} {# ... #} {% endfor %}
|
static |
Returns the last element of the item.
| mixed | $item | A variable |
|
static |
Returns the length of a variable.
| mixed | $thing | A variable |
|
static |
Converts a string to lowercase.
| string | null | $string | A string |
|
static |
| RuntimeError | When an invalid pattern is used |
|
static |
Merges any number of arrays or Traversable objects.
{% set items = { 'apple': 'fruit', 'orange': 'fruit' } %}
{% set items = items|merge({ 'peugeot': 'car' }, { 'banana': 'fruit' }) %}
{# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car', 'banana': 'fruit' } #}
| array| |
Traversable ...$arrays Any number of arrays or Traversable objects to merge
| modifyDate | ( | $date, | |
| $modifier ) |
Returns a new date object modified.
{{ post.published_at|date_modify("-1day")|date("m/d/Y") }}
| \DateTimeInterface | string | int | null | $date | A date, a timestamp or null to use the current time |
| string | $modifier | A modifier string |
|
static |
Inserts HTML line breaks before all newlines in a string.
| string | null | $string |
|
static |
Returns a random value depending on the supplied parameter type:
| \Traversable | array | int | float | string | $values | The values to pick a random item from |
| int | null | $max | Maximum value used when $values is an int |
| RuntimeError | when $values is an empty array (does not apply to an empty string which is returned as is) |
|
static |
Replaces strings within a string.
| string | null | $str | String to replace in |
| array | \Traversable | $from | Replace values |
|
static |
Reverses a variable.
| array | \Traversable | string | null | $item | An array, a \Traversable instance, or a string |
| bool | $preserveKeys | Whether to preserve key or not |
|
static |
Rounds a number.
| int | float | string | null | $value | The value to round |
| int | float | $precision | The rounding precision |
| 'common'|'ceil'|'floor' | $method The method to use for rounding |
| setDateFormat | ( | $format = null, | |
| $dateIntervalFormat = null ) |
Sets the default format to be used by the date filter.
| string | null | $format | The default date format string |
| string | null | $dateIntervalFormat | The default date interval format string |
| setNumberFormat | ( | $decimal, | |
| $decimalPoint, | |||
| $thousandSep ) |
Sets the default format to be used by the number_format filter.
| int | $decimal | the number of decimal places to use |
| string | $decimalPoint | the character(s) to use for the decimal point |
| string | $thousandSep | the character(s) to use for the thousands separator |
| setTimezone | ( | $timezone | ) |
Sets the default timezone to be used by the date filter.
| \DateTimeZone | string | $timezone | The default timezone string or a \DateTimeZone object |
|
static |
Shuffles an array, a \Traversable instance, or a string. The function does not preserve keys.
| array | \Traversable | string | null | $item |
|
static |
Slices a variable.
| mixed | $item | A variable |
| int | $start | Start of the slice |
| int | $length | Size of the slice |
| bool | $preserveKeys | Whether to preserve key or not (when the input is an array) |
|
static |
Sorts an array.
| array | \Traversable | $array | |
| ?\Closure | $arrow |
|
static |
Removes whitespaces between HTML tags.
| string | null | $content |
|
static |
Splits the string into an array.
{{ "one,two,three"|split(',') }} {# returns [one, two, three] #}
{{ "one,two,three,four,five"|split(',', 3) }} {# returns [one, two, "three,four,five"] #}
{{ "123"|split('') }} {# returns [1, 2, 3] #}
{{ "aabbcc"|split('', 2) }} {# returns [aa, bb, cc] #}
| string | null | $value | A string |
| string | $delimiter | The delimiter |
| int | null | $limit | The limit |
|
static |
Returns a formatted string.
| string | null | $format |
|
static |
Strips HTML and PHP tags from a string.
| string | null | $string | |
| string[] | string | null | $allowable_tags |
|
static |
Checks if a variable is empty.
{# evaluates to true if the foo variable is null, false, or the empty string #} {% if foo is empty %} {# ... #} {% endif %}
| mixed | $value | A variable |
|
static |
Checks if a variable is a mapping.
{# evaluates to true if the foo variable is a mapping #} {% if foo is mapping %} {# ... #} {% endif %}
|
static |
Checks if a variable is a sequence.
{# evaluates to true if the foo variable is a sequence #} {% if foo is sequence %} {# ... #} {% endif %}
|
static |
Returns a titlecased string.
| string | null | $string | A string |
|
static |
Returns a trimmed string.
| string | \Stringable | null | $string | |
| string | null | $characterMask | |
| string | $side | left, right, or both |
| RuntimeError | When an invalid trimming side is used |
|
static |
Converts a string to uppercase.
| string | null | $string | A string |
|
static |
URL encodes (RFC 3986) a string as a path segment or an array as a query string.
| string | array | null | $url | A URL or an array of query parameters |
| const ARRAY_LIKE_CLASSES |
|
static |
Renders a template.
| array | $context | |
| string | array | TemplateWrapper | $template | The template to render or an array of templates to try consecutively |
| array | $variables | The variables to pass to the template |
| bool | $withContext | |
| bool | $ignoreMissing | Whether to ignore missing templates or not |
| bool | $sandboxed | Whether to sandbox the template or not |