PHP 클래스 Neos\Flow\I18n\Parser\DatetimeParser

파일 보기 프로젝트 열기: neos/flow-development-collection

보호된 프로퍼티들

프로퍼티 타입 설명
$datesReader Neos\Flow\I18n\Cldr\Reader\DatesReader

공개 메소드들

메소드 설명
injectDatesReader ( DatesReader $datesReader ) : void
parseDate ( string $dateToParse, Locale $locale, string $formatLength = DatesReader::FORMAT_LENGTH_DEFAULT, boolean $strictMode = true ) : mixed Parses date with format string for date defined in CLDR for particular locale.
parseDateAndTime ( string $dateAndTimeToParse, Locale $locale, string $formatLength = DatesReader::FORMAT_LENGTH_DEFAULT, boolean $strictMode = true ) : mixed Parses dateTime with format string for date and time defined in CLDR for particular locale.
parseDatetimeWithCustomPattern ( string $datetimeToParse, string $format, Locale $locale, boolean $strictMode = true ) : mixed Returns dateTime parsed by custom format (string provided in parameter).
parseTime ( string $timeToParse, Locale $locale, string $formatLength = DatesReader::FORMAT_LENGTH_DEFAULT, boolean $strictMode = true ) : mixed Parses time with format string for time defined in CLDR for particular locale.

보호된 메소드들

메소드 설명
doParsingInLenientMode ( string $datetimeToParse, array $parsedFormat, array $localizedLiterals ) : array Parses date and / or time in lenient mode.
doParsingInStrictMode ( string $datetimeToParse, array $parsedFormat, array $localizedLiterals ) : array Parses date and / or time in strict mode.
doParsingWithParsedFormat ( string $datetimeToParse, array $parsedFormat, array $localizedLiterals, boolean $strictMode ) : mixed Parses date and / or time using parsed format, in strict or lenient mode.
extractAndCheckNumber ( string $datetimeToParse, boolean $isTwoDigits, integer $minValue, integer $maxValue ) : integer Extracts one or two-digit number from the beginning of the string.
extractNumberAndGetPosition ( string $datetimeToParse, integer &$position ) : string Extracts and returns first integer number encountered in provided string.

메소드 상세

doParsingInLenientMode() 보호된 메소드

Algorithm assumptions: - ignore all literals - order of elements in parsed format is important - length of subformat is not strictly checked (eg. 'h' and 'hh') - number must be in range in order to be accepted (eg. 1-12 for month) - some format fallback substitutions can be done (eg. 'Jan' for 'January')
또한 보기: DatesReader
protected doParsingInLenientMode ( string $datetimeToParse, array $parsedFormat, array $localizedLiterals ) : array
$datetimeToParse string Date/time to be parsed
$parsedFormat array Format parsed by DatesReader
$localizedLiterals array Array of date / time literals from CLDR
리턴 array Array of parsed date and / or time elements (can be array of NULLs if nothing was parsed)

doParsingInStrictMode() 보호된 메소드

Parses date and / or time in strict mode.
또한 보기: DatesReader
protected doParsingInStrictMode ( string $datetimeToParse, array $parsedFormat, array $localizedLiterals ) : array
$datetimeToParse string Date/time to be parsed
$parsedFormat array Format parsed by DatesReader
$localizedLiterals array Array of date / time literals from CLDR
리턴 array Array of parsed date and / or time elements, FALSE on failure

doParsingWithParsedFormat() 보호된 메소드

Parses date and / or time using parsed format, in strict or lenient mode.
protected doParsingWithParsedFormat ( string $datetimeToParse, array $parsedFormat, array $localizedLiterals, boolean $strictMode ) : mixed
$datetimeToParse string Date/time to be parsed
$parsedFormat array Parsed format (from DatesReader)
$localizedLiterals array Array of date / time literals from CLDR
$strictMode boolean Work mode (strict when TRUE, lenient when FALSE)
리턴 mixed Array of parsed date and / or time elements, FALSE on failure

extractAndCheckNumber() 보호된 메소드

If the number has certainly two digits, $isTwoDigits can be set to TRUE so no additional checking is done (this implies from some date/time formats, like 'hh'). Number is also checked for constraints: minimum and maximum value.
protected extractAndCheckNumber ( string $datetimeToParse, boolean $isTwoDigits, integer $minValue, integer $maxValue ) : integer
$datetimeToParse string Date/time to be parsed
$isTwoDigits boolean TRUE if number has surely two digits, FALSE if it has one or two digits
$minValue integer
$maxValue integer
리턴 integer Parsed number

extractNumberAndGetPosition() 보호된 메소드

Searches for first digit and extracts all adjacent digits. Also returns position of first digit in string.
protected extractNumberAndGetPosition ( string $datetimeToParse, integer &$position ) : string
$datetimeToParse string String to search number in
$position integer Index of first digit in string
리턴 string Extracted number

injectDatesReader() 공개 메소드

public injectDatesReader ( DatesReader $datesReader ) : void
$datesReader Neos\Flow\I18n\Cldr\Reader\DatesReader
리턴 void

parseDate() 공개 메소드

Parses date with format string for date defined in CLDR for particular locale.
public parseDate ( string $dateToParse, Locale $locale, string $formatLength = DatesReader::FORMAT_LENGTH_DEFAULT, boolean $strictMode = true ) : mixed
$dateToParse string date to be parsed
$locale Neos\Flow\I18n\Locale
$formatLength string One of: full, long, medium, short, or 'default' in order to use default length from CLDR
$strictMode boolean Work mode (strict when TRUE, lenient when FALSE)
리턴 mixed Array of parsed date elements, FALSE on failure

parseDateAndTime() 공개 메소드

Parses dateTime with format string for date and time defined in CLDR for particular locale.
public parseDateAndTime ( string $dateAndTimeToParse, Locale $locale, string $formatLength = DatesReader::FORMAT_LENGTH_DEFAULT, boolean $strictMode = true ) : mixed
$dateAndTimeToParse string Date and time to be parsed
$locale Neos\Flow\I18n\Locale
$formatLength string One of: full, long, medium, short, or 'default' in order to use default length from CLDR
$strictMode boolean Work mode (strict when TRUE, lenient when FALSE)
리턴 mixed Array of parsed date and time elements, FALSE on failure

parseDatetimeWithCustomPattern() 공개 메소드

Format must obey syntax defined in CLDR specification, excluding unimplemented features (see documentation for DatesReader class). Format is remembered in cache and won't be parsed again for some time.
또한 보기: DatesReader
public parseDatetimeWithCustomPattern ( string $datetimeToParse, string $format, Locale $locale, boolean $strictMode = true ) : mixed
$datetimeToParse string Date/time to be parsed
$format string Format string
$locale Neos\Flow\I18n\Locale A locale used for finding literals array
$strictMode boolean Work mode (strict when TRUE, lenient when FALSE)
리턴 mixed Array of parsed date / time elements, FALSE on failure

parseTime() 공개 메소드

Parses time with format string for time defined in CLDR for particular locale.
public parseTime ( string $timeToParse, Locale $locale, string $formatLength = DatesReader::FORMAT_LENGTH_DEFAULT, boolean $strictMode = true ) : mixed
$timeToParse string Time to be parsed
$locale Neos\Flow\I18n\Locale
$formatLength string One of: full, long, medium, short, or 'default' in order to use default length from CLDR
$strictMode boolean Work mode (strict when TRUE, lenient when FALSE)
리턴 mixed Array of parsed time elements, FALSE on failure

프로퍼티 상세

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

protected DatesReader,Neos\Flow\I18n\Cldr\Reader $datesReader
리턴 Neos\Flow\I18n\Cldr\Reader\DatesReader