메소드 | 설명 | |
---|---|---|
__construct ( Pico $pico ) | Constructs a new instance of this Twig extension | |
getFilters ( ) : Twig_SimpleFilter[] | Returns the Twig filters markdown, map and sort_by | |
getKeyOfVar ( array | Traversable | ArrayAccess | object $var, mixed $keyPath ) : mixed | Returns the value of a variable item specified by a scalar key or a arbitrary deep sub-key using a key path | |
getName ( ) : string | Returns the name of the extension | |
getPico ( ) : Pico | Returns the extensions instance of Pico | |
mapFilter ( array | Traversable $var, mixed $mapKeyPath ) : array | Returns a array with the values of the given key or key path | |
markdownFilter ( string $markdown ) : string | Parses a markdown string to HTML | |
sortByFilter ( array | Traversable $var, mixed $sortKeyPath, string $fallback = 'bottom' ) : array | Sorts an array by one of its keys or a arbitrary deep sub-key |
public __construct ( Pico $pico ) | ||
$pico | Pico | current instance of Pico |
public getFilters ( ) : Twig_SimpleFilter[] | ||
리턴 | Twig_SimpleFilter[] | array of Pico's Twig filters |
public static getKeyOfVar ( array | Traversable | ArrayAccess | object $var, mixed $keyPath ) : mixed | ||
$var | array | Traversable | ArrayAccess | object | base variable |
$keyPath | mixed | scalar key or a array interpreted as key path (when passing e.g. ['foo', 'bar'], the method will return $var['foo']['bar']) specifying the value |
리턴 | mixed | the requested value or NULL when the given key or key path didn't match |
public getPico ( ) : Pico | ||
리턴 | Pico | the extensions instance of Pico |
public mapFilter ( array | Traversable $var, mixed $mapKeyPath ) : array | ||
$var | array | Traversable | variable to map |
$mapKeyPath | mixed | key to map; either a scalar or a array interpreted as key path (i.e. ['foo', 'bar'] will return all $item['foo']['bar'] values) |
리턴 | array | mapped values |
public markdownFilter ( string $markdown ) : string | ||
$markdown | string | markdown to parse |
리턴 | string | parsed HTML |
public sortByFilter ( array | Traversable $var, mixed $sortKeyPath, string $fallback = 'bottom' ) : array | ||
$var | array | Traversable | variable to sort |
$sortKeyPath | mixed | key to use for sorting; either a scalar or a array interpreted as key path (i.e. ['foo', 'bar'] will sort $var by $item['foo']['bar']) |
$fallback | string | specify what to do with items which don't contain the specified sort key; use "bottom" (default) to move those items to the end of the sorted array, "top" to rank them first, or "keep" to keep the original order of those items |
리턴 | array | sorted array |