Passed
Pull Request — master (#2)
by tsms
01:39
created

Textual::orderedWeekdays()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/* vim: set expandtab tabstop=4 shiftwidth=4: */
3
4
/**
5
 * Contains the Calendar_Decorator_Wrapper class
6
 *
7
 * PHP versions 4 and 5
8
 *
9
 * LICENSE: Redistribution and use in source and binary forms, with or without
10
 * modification, are permitted provided that the following conditions are met:
11
 * 1. Redistributions of source code must retain the above copyright
12
 *    notice, this list of conditions and the following disclaimer.
13
 * 2. Redistributions in binary form must reproduce the above copyright
14
 *    notice, this list of conditions and the following disclaimer in the
15
 *    documentation and/or other materials provided with the distribution.
16
 * 3. The name of the author may not be used to endorse or promote products
17
 *    derived from this software without specific prior written permission.
18
 *
19
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
20
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22
 * IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY
23
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
 *
30
 * @category  Date and Time
31
 * @package   Calendar
32
 * @author    Harry Fuecks <[email protected]>
33
 * @author    Lorenzo Alberton <[email protected]>
34
 * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
35
 * @license   http://www.debian.org/misc/bsd.license  BSD License (3 Clause)
36
 * @version   CVS: $Id$
37
 * @link      http://pear.php.net/package/Calendar
38
 */
39
namespace Pear\Calendar\Decorator;
40
41
use Pear\Calendar\Decorator;
42
43
/**
44
 * Allows Calendar include path to be redefined
45
 * @ignore
46
 */
47
if (!defined('CALENDAR_ROOT')) {
48
    define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
49
}
50
51
/**
52
 * Load Calendar decorator base class
53
 */
54
require_once CALENDAR_ROOT.'Decorator.php';
55
56
/**
57
 * Load the Uri utility
58
 */
59
require_once CALENDAR_ROOT.'Util'.DIRECTORY_SEPARATOR.'Textual.php';
60
61
/**
62
 * Decorator to help with fetching textual representations of months and
63
 * days of the week.
64
 * <b>Note:</b> for performance you should prefer Calendar_Util_Textual unless you
65
 * have a specific need to use a decorator
66
 *
67
 * @category  Date and Time
68
 * @package   Calendar
69
 * @author    Harry Fuecks <[email protected]>
70
 * @author    Lorenzo Alberton <[email protected]>
71
 * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
72
 * @license   http://www.debian.org/misc/bsd.license  BSD License (3 Clause)
73
 * @link      http://pear.php.net/package/Calendar
74
 * @access    public
75
 */
76
class Textual extends Decorator
77
{
78
    /**
79
     * Constructs Calendar_Decorator_Textual
80
     *
81
     * @param object &$Calendar subclass of Calendar
82
     *
83
     * @access public
84
     */
85
    function __construct(&$Calendar)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
86
    {
87
        parent::__construct($Calendar);
88
    }
89
90
    /**
91
     * Returns an array of 12 month names (first index = 1)
92
     *
93
     * @param string $format (optional) format of returned months (one|two|short|long)
94
     *
95
     * @return array
96
     * @access public
97
     * @static
98
     */
99
    function monthNames($format = 'long')
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
100
    {
101
        return \Pear\Calendar\Util\Textual::monthNames($format);
0 ignored issues
show
Bug Best Practice introduced by
The method Pear\Calendar\Util\Textual::monthNames() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

101
        return \Pear\Calendar\Util\Textual::/** @scrutinizer ignore-call */ monthNames($format);
Loading history...
102
    }
103
104
    /**
105
     * Returns an array of 7 week day names (first index = 0)
106
     *
107
     * @param string $format (optional) format of returned days (one|two|short|long)
108
     *
109
     * @return array
110
     * @access public
111
     * @static
112
     */
113
    function weekdayNames($format = 'long')
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
114
    {
115
        return \Pear\Calendar\Util\Textual::weekdayNames($format);
0 ignored issues
show
Bug Best Practice introduced by
The method Pear\Calendar\Util\Textual::weekdayNames() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

115
        return \Pear\Calendar\Util\Textual::/** @scrutinizer ignore-call */ weekdayNames($format);
Loading history...
116
    }
117
118
    /**
119
     * Returns textual representation of the previous month of the decorated calendar object
120
     *
121
     * @param string $format (optional) format of returned months (one|two|short|long)
122
     *
123
     * @return string
124
     * @access public
125
     */
126
    function prevMonthName($format = 'long')
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
127
    {
128
        return \Pear\Calendar\Util\Textual::prevMonthName($this->calendar, $format);
0 ignored issues
show
Bug Best Practice introduced by
The method Pear\Calendar\Util\Textual::prevMonthName() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

128
        return \Pear\Calendar\Util\Textual::/** @scrutinizer ignore-call */ prevMonthName($this->calendar, $format);
Loading history...
129
    }
130
131
    /**
132
     * Returns textual representation of the month of the decorated calendar object
133
     *
134
     * @param string $format (optional) format of returned months (one|two|short|long)
135
     *
136
     * @return string
137
     * @access public
138
     */
139
    function thisMonthName($format = 'long')
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
140
    {
141
        return \Pear\Calendar\Util\Textual::thisMonthName($this->calendar, $format);
0 ignored issues
show
Bug Best Practice introduced by
The method Pear\Calendar\Util\Textual::thisMonthName() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

141
        return \Pear\Calendar\Util\Textual::/** @scrutinizer ignore-call */ thisMonthName($this->calendar, $format);
Loading history...
142
    }
143
144
    /**
145
     * Returns textual representation of the next month of the decorated calendar object
146
     *
147
     * @param string $format (optional) format of returned months (one|two|short|long)
148
     *
149
     * @return string
150
     * @access public
151
     */
152
    function nextMonthName($format = 'long')
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
153
    {
154
        return \Pear\Calendar\Util\Textual::nextMonthName($this->calendar, $format);
0 ignored issues
show
Bug Best Practice introduced by
The method Pear\Calendar\Util\Textual::nextMonthName() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

154
        return \Pear\Calendar\Util\Textual::/** @scrutinizer ignore-call */ nextMonthName($this->calendar, $format);
Loading history...
155
    }
156
157
    /**
158
     * Returns textual representation of the previous day of week of the decorated calendar object
159
     *
160
     * @param string $format (optional) format of returned months (one|two|short|long)
161
     *
162
     * @return string
163
     * @access public
164
     */
165
    function prevDayName($format = 'long')
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
166
    {
167
        return \Pear\Calendar\Util\Textual::prevDayName($this->calendar, $format);
0 ignored issues
show
Bug Best Practice introduced by
The method Pear\Calendar\Util\Textual::prevDayName() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

167
        return \Pear\Calendar\Util\Textual::/** @scrutinizer ignore-call */ prevDayName($this->calendar, $format);
Loading history...
168
    }
169
170
    /**
171
     * Returns textual representation of the day of week of the decorated calendar object
172
     *
173
     * @param string $format (optional) format of returned months (one|two|short|long)
174
     *
175
     * @return string
176
     * @access public
177
     */
178
    function thisDayName($format = 'long')
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
179
    {
180
        return \Pear\Calendar\Util\Textual::thisDayName($this->calendar, $format);
0 ignored issues
show
Bug Best Practice introduced by
The method Pear\Calendar\Util\Textual::thisDayName() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

180
        return \Pear\Calendar\Util\Textual::/** @scrutinizer ignore-call */ thisDayName($this->calendar, $format);
Loading history...
181
    }
182
183
    /**
184
     * Returns textual representation of the next day of week of the decorated calendar object
185
     *
186
     * @param string $format (optional) format of returned months (one|two|short|long)
187
     *
188
     * @return string
189
     * @access public
190
     */
191
    function nextDayName($format = 'long')
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
192
    {
193
        return \Pear\Calendar\Util\Textual::nextDayName($this->calendar, $format);
0 ignored issues
show
Bug Best Practice introduced by
The method Pear\Calendar\Util\Textual::nextDayName() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

193
        return \Pear\Calendar\Util\Textual::/** @scrutinizer ignore-call */ nextDayName($this->calendar, $format);
Loading history...
194
    }
195
196
    /**
197
     * Returns the days of the week using the order defined in the decorated
198
     * calendar object. Only useful for Calendar_Month_Weekdays, Calendar_Month_Weeks
199
     * and Calendar_Week. Otherwise the returned array will begin on Sunday
200
     *
201
     * @param string $format (optional) format of returned months (one|two|short|long)
202
     *
203
     * @return array ordered array of week day names
204
     * @access public
205
     */
206
    function orderedWeekdays($format = 'long')
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
207
    {
208
        return \Pear\Calendar\Util\Textual::orderedWeekdays($this->calendar, $format);
0 ignored issues
show
Bug Best Practice introduced by
The method Pear\Calendar\Util\Textual::orderedWeekdays() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

208
        return \Pear\Calendar\Util\Textual::/** @scrutinizer ignore-call */ orderedWeekdays($this->calendar, $format);
Loading history...
209
    }
210
}
211