- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
class Kohana_Date {
// ....
/**
* Number of hours in a day. Typically used as a shortcut for generating a
* list that can be used in a form.
*
* $hours = Date::hours(); // 01, 02, 03, ..., 10, 11, 12
*
* @param integer amount to increment each step by
* @param boolean use 24-hour time
* @param integer the hour to start at
* @return array A mirrored (foo => foo) array from start-12 or start-23.
*/
public static function hours($step = 1, $long = FALSE, $start = NULL)
{
// ... implementation
}
/**
* Number of months in a year. Typically used as a shortcut for generating
* a list that can be used in a form.
*
* Date::months(); // 01, 02, 03, ..., 10, 11, 12
*
* @uses Date::hours
* @return array A mirrored (foo => foo) array from 1-12.
*/
public static function months()
{
return Date::hours();
}
}
Занятный способ сократить код, правда вносящий небольшую суматоху )