Properties

$definitions

$definitions : 

Type

$args

$args : 

Type

$now

$now : 

Type

Methods

__construct()

__construct(  $args) 

Parameters

$args

parse()

parse(  $text,   $specifiedOptions = array()) 

Parses a string containing a natural language date or time. If the parser can find a date or time, either a Horde_Date or Horde_Date_Span will be returned (depending on the value of <tt>:return</tt>). If no date or time can be found, +nil+ will be returned.

Options are:

[:context] :past or :future (defaults to :future)

If your string represents a birthday, you can set <tt>:context</tt>
to <tt>:past</tt> and if an ambiguous string is given, it will
assume it is in the past. Specify <tt>:future</tt> or omit to set a
future context.

[:now] Time (defaults to time())

By setting <tt>:now</tt> to a Horde_Date, all computations will be
based off of that time instead of time().

[:return] 'result', 'span', or 'date' (defaults to 'date')

By default, the parser will guess a single point in time for the
given date or time. If you'd rather have the entire time span
returned, set <tt>:return</tt> to 'span' and a Horde_Date_Span will
be returned.  If you want the entire result, including tokens (for
retrieving the text that was or was not tagged, for example), set
<tt>:return</tt> to 'result' and you will get a result object.

[:ambiguousTimeRange] Integer or :none (defaults to 6 (6am-6pm))

If an Integer is given, ambiguous times (like 5:00) will be assumed
to be within the range of that time in the AM to that time in the
PM. For example, if you set it to <tt>7</tt>, then the parser will
look for the time between 7am and 7pm. In the case of 5:00, it would
assume that means 5:00pm. If <tt>:none</tt> is given, no assumption
will be made, and the first matching instance of that time will be
used.

Parameters

$text
$specifiedOptions

componentFactory()

componentFactory(  $component,   $args = null) 

Parameters

$component
$args

preNormalize()

preNormalize(  $text) 

Clean up the specified input text by stripping unwanted characters, converting idioms to their canonical form, converting number words to numbers (three => 3), and converting ordinal words to numeric ordinals (third => 3rd)

Parameters

$text

numericizeNumbers()

numericizeNumbers(  $text) 

Convert number words to numbers (three => 3)

Parameters

$text

numericizeOrdinals()

numericizeOrdinals(  $text) 

Convert ordinal words to numeric ordinals (third => 3rd)

Parameters

$text

preTokenize()

preTokenize(string  $text) : array

Split the text on spaces and convert each word into a Token.

Parameters

string $text

Text to tokenize

Returns

array —

Array of Horde_Date_Parser_Tokens.

postTokenize()

postTokenize(array  $tokens) : array

Remove tokens that don't fit our definitions.

Parameters

array $tokens

Array of tagged tokens.

Returns

array —

Filtered tagged tokens.

initDefinitions()

initDefinitions() 

tokensToSpan()

tokensToSpan(  $tokens,   $options) 

Parameters

$tokens
$options

dayOrTime()

dayOrTime(  $dayStart,   $timeTokens,   $options) 

Parameters

$dayStart
$timeTokens
$options

handle_m_d()

handle_m_d(  $month,   $day,   $timeTokens,   $options) 

Parameters

$month
$day
$timeTokens
$options

handle_rmn_sd()

handle_rmn_sd(  $tokens,   $options) 

Parameters

$tokens
$options

handle_rmn_od()

handle_rmn_od(  $tokens,   $options) 

Parameters

$tokens
$options

handle_rmn_sy()

handle_rmn_sy(  $tokens,   $options) 

Parameters

$tokens
$options

handle_rdn_rmn_sd_t_tz_sy()

handle_rdn_rmn_sd_t_tz_sy(  $tokens,   $options) 

Parameters

$tokens
$options

handle_rmn_sd_sy()

handle_rmn_sd_sy(  $tokens,   $options) 

Parameters

$tokens
$options

handle_sd_rmn_sy()

handle_sd_rmn_sy(  $tokens,   $options) 

Parameters

$tokens
$options

handle_sm_sd_sy()

handle_sm_sd_sy(  $tokens,   $options) 

Parameters

$tokens
$options

handle_sd_sm_sy()

handle_sd_sm_sy(  $tokens,   $options) 

Parameters

$tokens
$options

handle_sy_sm_sd()

handle_sy_sm_sd(  $tokens,   $options) 

Parameters

$tokens
$options

handle_sm_sy()

handle_sm_sy(  $tokens,   $options) 

Parameters

$tokens
$options

handle_r()

handle_r(  $tokens,   $options) 

Parameters

$tokens
$options

handle_r_g_r()

handle_r_g_r(  $tokens,   $options) 

Parameters

$tokens
$options

handle_srp()

handle_srp(  $tokens,   $span,   $options) 

Parameters

$tokens
$span
$options

handle_s_r_p()

handle_s_r_p(  $tokens,   $options) 

Parameters

$tokens
$options

handle_p_s_r()

handle_p_s_r(  $tokens,   $options) 

Parameters

$tokens
$options

handle_s_r_p_a()

handle_s_r_p_a(  $tokens,   $options) 

Parameters

$tokens
$options

handle_orr()

handle_orr(  $tokens,   $outerSpan,   $options) 

Parameters

$tokens
$outerSpan
$options

handle_o_r_s_r()

handle_o_r_s_r(  $tokens,   $options) 

Parameters

$tokens
$options

handle_o_r_g_r()

handle_o_r_g_r(  $tokens,   $options) 

Parameters

$tokens
$options

debug()

debug(  $method,   $args) 

Parameters

$method
$args

getAnchor()

getAnchor(  $tokens,   $options) 

Parameters

$tokens
$options

getRepeaters()

getRepeaters(  $tokens) 

Parameters

$tokens

findWithin()

findWithin(  $tags,   $span,   $pointer) 

Recursively finds repeaters within other repeaters. Returns a Span representing the innermost time span or null if no repeater union could be found

Parameters

$tags
$span
$pointer

dealiasAndDisambiguateTimes()

dealiasAndDisambiguateTimes(  $tokens,   $options) 

handle aliases of am/pm 5:00 in the morning -> 5:00 am 7:00 in the evening -> 7:00 pm

Parameters

$tokens
$options

handle_rdn()

handle_rdn(  $tokens,   $options) 

Parameters

$tokens
$options

handle_sd_rmn()

handle_sd_rmn(  $tokens,   $options) 

Parameters

$tokens
$options

handle_od_rmn()

handle_od_rmn(  $tokens,   $options) 

Parameters

$tokens
$options