DAViCal
 All Classes Namespaces Functions Variables Pages
Rfc5545Duration Class Reference

Public Member Functions

 __construct ($in_duration)
 
 equals ($other)
 
 asSeconds ()
 
 __toString ()
 

Static Public Member Functions

static fromTwoDates ($d1, $d2)
 

Private Attributes

 $epoch_seconds = null
 
 $days = 0
 
 $secs = 0
 
 $as_text = ''
 

Detailed Description

Provide a useful way of dealing with RFC5545 duration strings of the form ^(-?)P(?:(+W)|(?:(?:(+)D)?(?:T(?:(+)H)?(?:(+)M)?(?:(+)S?)?)?))$ This doesn't fully implement the RFC, as it allows PT10H10S - which should be invalid as no minutes are present.

Definition at line 79 of file RRule.php.

Constructor & Destructor Documentation

Rfc5545Duration::__construct (   $in_duration)

Construct a new Rfc5545Duration either from incoming seconds or a text string.

Parameters
mixed$in_duration

Definition at line 89 of file RRule.php.

Member Function Documentation

Rfc5545Duration::__toString ( )

Returns the duration as a text string of the form ^(-?)P(+W)|((+D)?(T(+H)?(+M)?(+S)?)?)$

Returns
string The stringified stuff.

Definition at line 151 of file RRule.php.

Rfc5545Duration::asSeconds ( )

Returns the duration as epoch seconds.

Definition at line 118 of file RRule.php.

Rfc5545Duration::equals (   $other)

Return true if $this and $other are equal, false otherwise.

Parameters
Rfc5545Duration$other
Returns
boolean

Definition at line 109 of file RRule.php.

static Rfc5545Duration::fromTwoDates (   $d1,
  $d2 
)
static

Factory method to return an Rfc5545Duration object from the difference between two dates.

This is flawed, at present: we should really localise both dates and work out the difference in days, then localise the times and work out the difference between the clock times. On the other hand we're replacing a quick and dirty hack that did it exactly the same way in the past, so we're not making things any worse and at least we're making it clear that it could be improved...

The problem strikes (as they all do) across DST boundaries.

Todo:
Improve this to calculate the days difference and then the clock time diff and work from there.
Parameters
RepeatRuleDateTime$d1
RepeatRuleDateTime$d2
Returns
Rfc5545Duration

Definition at line 198 of file RRule.php.


The documentation for this class was generated from the following file: