PHP 클래스 CRUDlex\TwigExtensions

파일 보기 프로젝트 열기: philiplb/crudlex 1 사용 예제들

공개 메소드들

메소드 설명
formatDate ( string $value, boolean $isUTC ) : string Formats the given value to a date of the format 'Y-m-d'.
formatDateTime ( string $value, boolean $isUTC ) : string Formats the given value to a date of the format 'Y-m-d H:i'.
formatFloat ( float $float ) : double | string Formats a float to not display in scientific notation.
getLanguageName ( string $language ) : string Gets a language name in the given language.
registerTwigExtensions ( Pimple\Container $app ) Registers all extensions.

보호된 메소드들

메소드 설명
formatTime ( string $value, string $timezone, string $pattern ) : string Formats the given time value to a timestring defined by the $pattern parameter.

메소드 상세

formatDate() 공개 메소드

Formats the given value to a date of the format 'Y-m-d'.
public formatDate ( string $value, boolean $isUTC ) : string
$value string the value, might be of the format 'Y-m-d H:i' or 'Y-m-d'
$isUTC boolean whether the given value is in UTC
리턴 string the formatted result or an empty string on null value

formatDateTime() 공개 메소드

Formats the given value to a date of the format 'Y-m-d H:i'.
public formatDateTime ( string $value, boolean $isUTC ) : string
$value string the value, might be of the format 'Y-m-d H:i'
$isUTC boolean whether the given value is in UTC
리턴 string the formatted result or an empty string on null value

formatFloat() 공개 메소드

Formats a float to not display in scientific notation.
public formatFloat ( float $float ) : double | string
$float float the float to format
리턴 double | string the formated float

formatTime() 보호된 메소드

If the value is false (like null), an empty string is returned. Else, the value is tried to be parsed as datetime via the given pattern. If that fails, it is tried to be parsed with the pattern 'Y-m-d H:i:s'. If that fails, the value is returned unchanged. Else, it is returned formatted with the given pattern. The effect is to shorten 'Y-m-d H:i:s' to 'Y-m-d' for example.
protected formatTime ( string $value, string $timezone, string $pattern ) : string
$value string the value to be formatted
$timezone string the timezone of the value
$pattern string the pattern with which the value is parsed and formatted
리턴 string the formatted value

getLanguageName() 공개 메소드

Gets a language name in the given language.
public getLanguageName ( string $language ) : string
$language string the language code of the desired language name
리턴 string the language name in the given language or null if not available

registerTwigExtensions() 공개 메소드

Registers all extensions.
public registerTwigExtensions ( Pimple\Container $app )
$app Pimple\Container the current application