Calendar_Decorator_Textual   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 122
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 10
eloc 11
dl 0
loc 122
rs 10
c 0
b 0
f 0

10 Methods

Rating   Name   Duplication   Size   Complexity  
A orderedWeekdays() 0 3 1
A weekdayNames() 0 3 1
A __construct() 0 3 1
A nextDayName() 0 3 1
A thisDayName() 0 3 1
A prevDayName() 0 3 1
A thisMonthName() 0 3 1
A monthNames() 0 3 1
A prevMonthName() 0 3 1
A nextMonthName() 0 3 1
1
<?php
2
3
/* vim: set expandtab tabstop=4 shiftwidth=4: */
4
5
/**
6
 * Contains the Calendar_Decorator_Wrapper class.
7
 *
8
 * PHP versions 4 and 5
9
 *
10
 * LICENSE: Redistribution and use in source and binary forms, with or without
11
 * modification, are permitted provided that the following conditions are met:
12
 * 1. Redistributions of source code must retain the above copyright
13
 *    notice, this list of conditions and the following disclaimer.
14
 * 2. Redistributions in binary form must reproduce the above copyright
15
 *    notice, this list of conditions and the following disclaimer in the
16
 *    documentation and/or other materials provided with the distribution.
17
 * 3. The name of the author may not be used to endorse or promote products
18
 *    derived from this software without specific prior written permission.
19
 *
20
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
21
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23
 * IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY
24
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
 *
31
 * @category  Date and Time
32
 *
33
 * @author    Harry Fuecks <[email protected]>
34
 * @author    Lorenzo Alberton <[email protected]>
35
 * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
36
 * @license   http://www.debian.org/misc/bsd.license  BSD License (3 Clause)
37
 *
38
 * @link      http://pear.php.net/package/Calendar
39
 */
40
41
/**
42
 * Allows Calendar include path to be redefined.
43
 *
44
 * @ignore
45
 */
46
if (!defined('CALENDAR_ROOT')) {
47
    define('CALENDAR_ROOT', 'Calendar/');
48
}
49
50
/**
51
 * Load Calendar decorator base class.
52
 */
53
require_once CALENDAR_ROOT . 'Decorator.php';
54
55
/**
56
 * Load the Uri utility.
57
 */
58
require_once CALENDAR_ROOT . 'Util/Textual.php';
59
60
/**
61
 * Decorator to help with fetching textual representations of months and
62
 * days of the week.
63
 * <b>Note:</b> for performance you should prefer Calendar_Util_Textual unless you
64
 * have a specific need to use a decorator.
65
 *
66
 * @category  Date and Time
67
 *
68
 * @author    Harry Fuecks <[email protected]>
69
 * @author    Lorenzo Alberton <[email protected]>
70
 * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
71
 * @license   http://www.debian.org/misc/bsd.license  BSD License (3 Clause)
72
 *
73
 * @link      http://pear.php.net/package/Calendar
74
 */
75
class Calendar_Decorator_Textual extends Calendar_Decorator
76
{
77
    /**
78
     * Constructs Calendar_Decorator_Textual.
79
     *
80
     * @param object $Calendar subclass of Calendar
81
     */
82
    public function __construct(&$Calendar)
83
    {
84
        parent::__construct($Calendar);
85
    }
86
87
    /**
88
     * Returns an array of 12 month names (first index = 1).
89
     *
90
     * @param string $format (optional) format of returned months (one|two|short|long)
91
     *
92
     * @return array
93
     * @static
94
     */
95
    public function monthNames($format = 'long')
96
    {
97
        return Calendar_Util_Textual::monthNames($format);
98
    }
99
100
    /**
101
     * Returns an array of 7 week day names (first index = 0).
102
     *
103
     * @param string $format (optional) format of returned days (one|two|short|long)
104
     *
105
     * @return array
106
     * @static
107
     */
108
    public function weekdayNames($format = 'long')
109
    {
110
        return Calendar_Util_Textual::weekdayNames($format);
111
    }
112
113
    /**
114
     * Returns textual representation of the previous month of the decorated calendar object.
115
     *
116
     * @param string $format (optional) format of returned months (one|two|short|long)
117
     *
118
     * @return string
119
     */
120
    public function prevMonthName($format = 'long')
121
    {
122
        return Calendar_Util_Textual::prevMonthName($this->calendar, $format);
123
    }
124
125
    /**
126
     * Returns textual representation of the month of the decorated calendar object.
127
     *
128
     * @param string $format (optional) format of returned months (one|two|short|long)
129
     *
130
     * @return string
131
     */
132
    public function thisMonthName($format = 'long')
133
    {
134
        return Calendar_Util_Textual::thisMonthName($this->calendar, $format);
135
    }
136
137
    /**
138
     * Returns textual representation of the next month of the decorated calendar object.
139
     *
140
     * @param string $format (optional) format of returned months (one|two|short|long)
141
     *
142
     * @return string
143
     */
144
    public function nextMonthName($format = 'long')
145
    {
146
        return Calendar_Util_Textual::nextMonthName($this->calendar, $format);
147
    }
148
149
    /**
150
     * Returns textual representation of the previous day of week of the decorated calendar object.
151
     *
152
     * @param string $format (optional) format of returned months (one|two|short|long)
153
     *
154
     * @return string
155
     */
156
    public function prevDayName($format = 'long')
157
    {
158
        return Calendar_Util_Textual::prevDayName($this->calendar, $format);
159
    }
160
161
    /**
162
     * Returns textual representation of the day of week of the decorated calendar object.
163
     *
164
     * @param string $format (optional) format of returned months (one|two|short|long)
165
     *
166
     * @return string
167
     */
168
    public function thisDayName($format = 'long')
169
    {
170
        return Calendar_Util_Textual::thisDayName($this->calendar, $format);
171
    }
172
173
    /**
174
     * Returns textual representation of the next day of week of the decorated calendar object.
175
     *
176
     * @param string $format (optional) format of returned months (one|two|short|long)
177
     *
178
     * @return string
179
     */
180
    public function nextDayName($format = 'long')
181
    {
182
        return Calendar_Util_Textual::nextDayName($this->calendar, $format);
183
    }
184
185
    /**
186
     * Returns the days of the week using the order defined in the decorated
187
     * calendar object. Only useful for Calendar_Month_Weekdays, Calendar_Month_Weeks
188
     * and Calendar_Week. Otherwise the returned array will begin on Sunday.
189
     *
190
     * @param string $format (optional) format of returned months (one|two|short|long)
191
     *
192
     * @return array ordered array of week day names
193
     */
194
    public function orderedWeekdays($format = 'long')
195
    {
196
        return Calendar_Util_Textual::orderedWeekdays($this->calendar, $format);
197
    }
198
}
199