Passed
Pull Request — master (#2)
by tsms
02:11
created

Calendar_Decorator_Textual   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 133
Duplicated Lines 0 %

Importance

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

9 Methods

Rating   Name   Duplication   Size   Complexity  
A monthNames() 0 3 1
A weekdayNames() 0 3 1
A thisDayName() 0 3 1
A thisMonthName() 0 3 1
A prevMonthName() 0 3 1
A prevDayName() 0 3 1
A nextDayName() 0 3 1
A nextMonthName() 0 3 1
A __construct() 0 3 1
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
/**
42
 * Allows Calendar include path to be redefined
43
 * @ignore
44
 */
45
if (!defined('CALENDAR_ROOT')) {
46
    define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
47
}
48
49
/**
50
 * Load Calendar decorator base class
51
 */
52
require_once CALENDAR_ROOT.'Decorator.php';
53
54
/**
55
 * Load the Uri utility
56
 */
57
require_once CALENDAR_ROOT.'Util'.DIRECTORY_SEPARATOR.'Textual.php';
58
59
/**
60
 * Decorator to help with fetching textual representations of months and
61
 * days of the week.
62
 * <b>Note:</b> for performance you should prefer Calendar_Util_Textual unless you
63
 * have a specific need to use a decorator
64
 *
65
 * @category  Date and Time
66
 * @package   Calendar
67
 * @author    Harry Fuecks <[email protected]>
68
 * @author    Lorenzo Alberton <[email protected]>
69
 * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
70
 * @license   http://www.debian.org/misc/bsd.license  BSD License (3 Clause)
71
 * @link      http://pear.php.net/package/Calendar
72
 * @access    public
73
 */
74
class Calendar_Decorator_Textual extends Calendar_Decorator
75
{
76
    /**
77
     * Constructs Calendar_Decorator_Textual
78
     *
79
     * @param object &$Calendar subclass of Calendar
80
     *
81
     * @access public
82
     */
83
    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...
84
    {
85
        parent::__construct($Calendar);
86
    }
87
88
    /**
89
     * Returns an array of 12 month names (first index = 1)
90
     *
91
     * @param string $format (optional) format of returned months (one|two|short|long)
92
     *
93
     * @return array
94
     * @access public
95
     * @static
96
     */
97
    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...
98
    {
99
        return Calendar_Util_Textual::monthNames($format);
0 ignored issues
show
Bug introduced by
The type Pear\Calendar\Decorator\Calendar_Util_Textual was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
100
    }
101
102
    /**
103
     * Returns an array of 7 week day names (first index = 0)
104
     *
105
     * @param string $format (optional) format of returned days (one|two|short|long)
106
     *
107
     * @return array
108
     * @access public
109
     * @static
110
     */
111
    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...
112
    {
113
        return Calendar_Util_Textual::weekdayNames($format);
114
    }
115
116
    /**
117
     * Returns textual representation of the previous month of the decorated calendar object
118
     *
119
     * @param string $format (optional) format of returned months (one|two|short|long)
120
     *
121
     * @return string
122
     * @access public
123
     */
124
    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...
125
    {
126
        return Calendar_Util_Textual::prevMonthName($this->calendar, $format);
127
    }
128
129
    /**
130
     * Returns textual representation of the month of the decorated calendar object
131
     *
132
     * @param string $format (optional) format of returned months (one|two|short|long)
133
     *
134
     * @return string
135
     * @access public
136
     */
137
    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...
138
    {
139
        return Calendar_Util_Textual::thisMonthName($this->calendar, $format);
140
    }
141
142
    /**
143
     * Returns textual representation of the next month of the decorated calendar object
144
     *
145
     * @param string $format (optional) format of returned months (one|two|short|long)
146
     *
147
     * @return string
148
     * @access public
149
     */
150
    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...
151
    {
152
        return Calendar_Util_Textual::nextMonthName($this->calendar, $format);
153
    }
154
155
    /**
156
     * Returns textual representation of the previous day of week of the decorated calendar object
157
     *
158
     * @param string $format (optional) format of returned months (one|two|short|long)
159
     *
160
     * @return string
161
     * @access public
162
     */
163
    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...
164
    {
165
        return Calendar_Util_Textual::prevDayName($this->calendar, $format);
166
    }
167
168
    /**
169
     * Returns textual representation of the day of week of the decorated calendar object
170
     *
171
     * @param string $format (optional) format of returned months (one|two|short|long)
172
     *
173
     * @return string
174
     * @access public
175
     */
176
    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...
177
    {
178
        return Calendar_Util_Textual::thisDayName($this->calendar, $format);
179
    }
180
181
    /**
182
     * Returns textual representation of the next day of week of the decorated calendar object
183
     *
184
     * @param string $format (optional) format of returned months (one|two|short|long)
185
     *
186
     * @return string
187
     * @access public
188
     */
189
    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...
190
    {
191
        return Calendar_Util_Textual::nextDayName($this->calendar, $format);
192
    }
193
194
    /**
195
     * Returns the days of the week using the order defined in the decorated
196
     * calendar object. Only useful for Calendar_Month_Weekdays, Calendar_Month_Weeks
197
     * and Calendar_Week. Otherwise the returned array will begin on Sunday
198
     *
199
     * @param string $format (optional) format of returned months (one|two|short|long)
200
     *
201
     * @return array ordered array of week day names
202
     * @access public
203
     */
204
    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...
205
    {
206
        return Calendar_Util_Textual::orderedWeekdays($this->calendar, $format);
207
    }
208
}
209