Loading...
Searching...
No Matches
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(?:(\d+W)|(?:(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S?)?)?))$ This doesn't fully implement the RFC, as it allows PT10H10S - which should be invalid as no minutes are present.

Definition at line 77 of file RRule.php.

## Constructor & Destructor Documentation

## __construct()

Rfc5545Duration::__construct | ( |  | $in_duration | ) |

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

Parameters

  mixed | $in_duration |

Definition at line 87 of file RRule.php.

## Member Function Documentation

## __toString()

Rfc5545Duration::__toString | ( |  | ) |

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

Returns
  string The stringified stuff.

Definition at line 149 of file RRule.php.

## asSeconds()

Rfc5545Duration::asSeconds | ( |  | ) |

Returns the duration as epoch seconds.

Definition at line 116 of file RRule.php.

## equals()

Rfc5545Duration::equals | ( |  | $other | ) |

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

Parameters

  Rfc5545Duration | $other |

Returns
  boolean

Definition at line 107 of file RRule.php.

## fromTwoDates()

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.

## Member Data Documentation

## $as_text

Rfc5545Duration::$as_text = ''

private

Definition at line 81 of file RRule.php.

## $days

Rfc5545Duration::$days = 0

private

Definition at line 79 of file RRule.php.

## $epoch_seconds

Rfc5545Duration::$epoch_seconds = null

private

Definition at line 78 of file RRule.php.

## $secs

Rfc5545Duration::$secs = 0

private

Definition at line 80 of file RRule.php.

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

- inc/RRule.php