Skip to content

Commit

Permalink
Improving some doc blocks in the Time class
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Apr 21, 2014
1 parent dc4bd1d commit 387f9d7
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/Utility/Time.php
Expand Up @@ -32,8 +32,13 @@ class Time extends Carbon {
/**
* The format to use when formatting a time using `Cake\Utility\Time::nice()`
*
* The format should use the locale strings as defined in the PHP docs under
* `strftime` (http://php.net/manual/en/function.strftime.php)
* The format should be eiter the formatting constants from IntDateFormatter as
* described in (http://www.php.net/manual/en/class.intldateformatter.php) or a pattern
* as specified in (http://www.icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details)
*
* It is possible to provide an array of 2 constants. In this case, the first position
* will be used for formatting the date part of the object and the second position
* will be used to format the time part.
*
* @var mixed
* @see \Cake\Utility\Time::nice()
Expand Down Expand Up @@ -87,15 +92,14 @@ public function __construct($time = null, $tz = null) {
}

/**
* Returns a nicely formatted date string for given Datetime string.
* Returns a nicely formatted date string for this object.
*
* See http://php.net/manual/en/function.strftime.php for information on formatting
* using locale strings.
* The format to be used is stored in the static property `Time::niceFormat`.
*
* @param int|string|\DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
* @param string|\DateTimeZone $timezone Timezone string or DateTimeZone object
* in which the date will be displayed. The timezone stored for this object will not
* be changed.
* @return string Formatted date string
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::nice
*/
public function nice($timezone = null) {
$time = $this;
Expand Down Expand Up @@ -164,7 +168,7 @@ public function toQuarter($range = false) {
*
* @return int Unix timestamp
*/
public static function toUnixString() {
public function toUnixString() {
return $this->format('U');
}

Expand Down

0 comments on commit 387f9d7

Please sign in to comment.