Overview

Packages

  • Date

Classes

  • Horde_Date
  • Horde_Date_Exception
  • Horde_Date_Recurrence
  • Horde_Date_Repeater
  • Horde_Date_Repeater_Day
  • Horde_Date_Repeater_DayName
  • Horde_Date_Repeater_DayPortion
  • Horde_Date_Repeater_Fortnight
  • Horde_Date_Repeater_Hour
  • Horde_Date_Repeater_Minute
  • Horde_Date_Repeater_Month
  • Horde_Date_Repeater_MonthName
  • Horde_Date_Repeater_Season
  • Horde_Date_Repeater_SeasonName
  • Horde_Date_Repeater_Second
  • Horde_Date_Repeater_Time
  • Horde_Date_Repeater_Week
  • Horde_Date_Repeater_Weekend
  • Horde_Date_Repeater_Year
  • Horde_Date_Span
  • Horde_Date_Translation
  • Horde_Date_Utils

Exceptions

  • Horde_Date_Repeater_Exception
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Copyright 2009-2012 Horde LLC (http://www.horde.org/)
 4:  *
 5:  * See the enclosed file COPYING for license information (LGPL). If you
 6:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 7:  *
 8:  * @category Horde
 9:  * @package  Date
10:  */
11: 
12: /**
13:  * @category Horde
14:  * @package  Date
15:  */
16: class Horde_Date_Repeater_Minute extends Horde_Date_Repeater
17: {
18:     public $currentMinuteStart;
19: 
20:     public function next($pointer = 'future')
21:     {
22:         parent::next($pointer);
23: 
24:         if (!$this->currentMinuteStart) {
25:             $this->currentMinuteStart = new Horde_Date(array('month' => $this->now->month, 'year' => $this->now->year, 'day' => $this->now->day, 'hour' => $this->now->hour, 'min' => $this->now->min));
26:         }
27:         $direction = ($pointer == 'future') ? 1 : -1;
28:         $this->currentMinuteStart->min += $direction;
29: 
30:         $end = clone $this->currentMinuteStart;
31:         $end->min++;
32:         return new Horde_Date_Span($this->currentMinuteStart, $end);
33:     }
34: 
35:     public function this($pointer = 'future')
36:     {
37:         parent::this($pointer);
38: 
39:         switch ($pointer) {
40:         case 'future':
41:             $minuteBegin = clone $this->now;
42:             $minuteEnd = new Horde_Date(array('month' => $this->now->month, 'year' => $this->now->year, 'day' => $this->now->day, 'hour' => $this->now->hour, 'min' => $this->now->min));
43:             break;
44: 
45:         case 'past':
46:             $minuteBegin = new Horde_Date(array('month' => $this->now->month, 'year' => $this->now->year, 'day' => $this->now->day, 'hour' => $this->now->hour, 'min' => $this->now->min));
47:             $minuteEnd = clone $this->now;
48:             break;
49: 
50:         case 'none':
51:             $minuteBegin = new Horde_Date(array('month' => $this->now->month, 'year' => $this->now->year, 'day' => $this->now->day, 'hour' => $this->now->hour, 'min' => $this->now->min));
52:             $minuteEnd = new Horde_Date(array('month' => $this->now->month, 'year' => $this->now->year, 'day' => $this->now->day, 'hour' => $this->now->hour, 'min' => $this->now->min + 1));
53:             break;
54:         }
55: 
56:         return new Horde_Date_Span($minuteBegin, $minuteEnd);
57:     }
58: 
59:     public function offset($span, $amount, $pointer)
60:     {
61:         $direction = ($pointer == 'future') ? 1 : -1;
62:         return $span->add(array('min' => $direction * $amount));
63:     }
64: 
65:     public function width()
66:     {
67:         return 60;
68:     }
69: 
70:     public function __toString()
71:     {
72:         return parent::__toString() . '-minute';
73:     }
74: 
75: }
76: 
API documentation generated by ApiGen