Commit 2c54c394 authored by alexpott's avatar alexpott

Issue #2702835 by ztl8702, pjonckiere, himanshugautam, dpovshed, mpdonadio:...

Issue #2702835 by ztl8702, pjonckiere, himanshugautam, dpovshed, mpdonadio: Update Doxygen for \Drupal\Component\DateTimePlus
parent 2c22ebbd
......@@ -104,6 +104,9 @@ class DateTimePlus {
* A DateTime object.
* @param array $settings
* @see __construct()
*
* @return static
* A new DateTimePlus object.
*/
public static function createFromDateTime(\DateTime $datetime, $settings = array()) {
return new static($datetime->format(static::FORMAT), $datetime->getTimezone(), $settings);
......@@ -125,8 +128,10 @@ public static function createFromDateTime(\DateTime $datetime, $settings = array
* __construct().
*
* @return static
* A new \Drupal\Component\DateTimePlus object based on the parameters
* passed in.
* A new DateTimePlus object.
*
* @throws \Exception
* If the array date values or value combination is not correct.
*/
public static function createFromArray(array $date_parts, $timezone = NULL, $settings = array()) {
$date_parts = static::prepareArray($date_parts, TRUE);
......@@ -155,6 +160,12 @@ public static function createFromArray(array $date_parts, $timezone = NULL, $set
* @see __construct()
* @param array $settings
* @see __construct()
*
* @return static
* A new DateTimePlus object.
*
* @throws \Exception
* If the timestamp is not numeric.
*/
public static function createFromTimestamp($timestamp, $timezone = NULL, $settings = array()) {
if (!is_numeric($timestamp)) {
......@@ -187,6 +198,13 @@ public static function createFromTimestamp($timestamp, $timezone = NULL, $settin
* from a format string exactly matches the input. This option
* indicates the format can be used for validation. Defaults to TRUE.
* @see __construct()
*
* @return static
* A new DateTimePlus object.
*
* @throws \Exception
* If the a date cannot be created from the given format, or if the
* created date does not match the input value.
*/
public static function createFromFormat($format, $time, $timezone = NULL, $settings = array()) {
if (!isset($settings['validate_format'])) {
......@@ -348,6 +366,9 @@ public function __clone() {
* @param mixed $time
* An input value, which could be a timestamp, a string,
* or an array of date parts.
*
* @return mixed
* The massaged time.
*/
protected function prepareTime($time) {
return $time;
......@@ -362,6 +383,9 @@ protected function prepareTime($time) {
*
* @param mixed $timezone
* Either a timezone name or a timezone object or NULL.
*
* @return \DateTimeZone
* The massaged time zone.
*/
protected function prepareTimezone($timezone) {
// If the input timezone is a valid timezone object, use it.
......@@ -394,6 +418,9 @@ protected function prepareTimezone($timezone) {
*
* @param string $format
* A PHP format string.
*
* @return string
* The massaged PHP format string.
*/
protected function prepareFormat($format) {
return $format;
......@@ -427,6 +454,10 @@ public function checkErrors() {
/**
* Detects if there were errors in the processing of this date.
*
* @return boolean
* TRUE if there were errors in the processing of this date, FALSE
* otherwise.
*/
public function hasErrors() {
return (boolean) count($this->errors);
......@@ -436,6 +467,9 @@ public function hasErrors() {
* Gets error messages.
*
* Public function to return the error messages.
*
* @return array
* An array of errors encountered when creating this date.
*/
public function getErrors() {
return $this->errors;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment