Erebot  latest
A modular IRC bot for PHP 5.3+
Erebot\Styling\Variables\DateTimeVariable Class Reference

A class used to format dates/times. More...

+ Inheritance diagram for Erebot\Styling\Variables\DateTimeVariable:

Public Member Functions

 __construct ($value, $datetype, $timetype, $timezone=null)
 
 getDateType ()
 
 getTimeType ()
 
 getTimeZone ()
 
 getValue ()
 
 render (\Erebot\IntlInterface $translator)
 

Protected Attributes

 $datetype
 Type of rendering to apply to dates.
 
 $timetype
 Type of rendering to apply to times.
 
 $timezone
 Timezone to use during the rendering prcess.
 
 $value
 A value expressing a date/time.
 

Detailed Description

A class used to format dates/times.

Definition at line 27 of file DateTimeVariable.php.

Constructor & Destructor Documentation

Erebot\Styling\Variables\DateTimeVariable::__construct (   $value,
  $datetype,
  $timetype,
  $timezone = null 
)

Constructor.

Parameters
mixed$valueA value representing a date/time that will be formatted. This may be a DateTime object, an integer representing a Unix timestamp value (seconds since epoch, UTC) or an array in the format output by localtime().
opaque$datetypeThe type of rendering to apply to dates. This is one of the constants defined in http://php.net/manual/en/class.intldateformatter.php
opaque$timetypeThe type of rendering to apply to times. This is one of the constants defined in http://php.net/manual/en/class.intldateformatter.php
string | null$timezone(optional) Timezone to use when rendering dates/times, eg. "Europe/Paris". The default is to use the system's default timezone, as returned by date_default_timezone_get().

Definition at line 67 of file DateTimeVariable.php.

References Erebot\Styling\Variables\DateTimeVariable\$datetype, Erebot\Styling\Variables\DateTimeVariable\$timetype, Erebot\Styling\Variables\DateTimeVariable\$timezone, and Erebot\Styling\Variables\DateTimeVariable\$value.

Member Function Documentation

Erebot\Styling\Variables\DateTimeVariable::getDateType ( )

Returns the type of rendering used for dates.

Return values
opaqueThe type of rendering used for dates. This is one of the constants defined in http://php.net/manual/en/class.intldateformatter.php

Implements Erebot\Styling\Variables\DateTimeInterface.

Definition at line 95 of file DateTimeVariable.php.

References Erebot\Styling\Variables\DateTimeVariable\$datetype.

Erebot\Styling\Variables\DateTimeVariable::getTimeType ( )

Returns the type of rendering used for times.

Return values
opaqueThe type of rendering used for dates. This is one of the constants defined in http://php.net/manual/en/class.intldateformatter.php

Implements Erebot\Styling\Variables\DateTimeInterface.

Definition at line 100 of file DateTimeVariable.php.

References Erebot\Styling\Variables\DateTimeVariable\$timetype.

Erebot\Styling\Variables\DateTimeVariable::getTimeZone ( )

Returns the timezone used to format values.

Return values
stringThe name of the timezone used to format dates and times (eg. "Europe/Paris").
NULLNULL is returned in case no timezone was specified during this object's creation. In that case, the current timezone of the system is used to render dates/times.

Implements Erebot\Styling\Variables\DateTimeInterface.

Definition at line 105 of file DateTimeVariable.php.

References Erebot\Styling\Variables\DateTimeVariable\$timezone.

Erebot\Styling\Variables\DateTimeVariable::getValue ( )

Returns the value stored in this object.

Return values
mixedValue stored in this object.

Implements Erebot\Styling\VariableInterface.

Definition at line 90 of file DateTimeVariable.php.

References Erebot\Styling\Variables\DateTimeVariable\$value.

Erebot\Styling\Variables\DateTimeVariable::render ( \Erebot\IntlInterface  $translator)

Renders the content of this variable.

Parameters
Erebot::IntlInterface$translatorA translator that can be used to change the rendering depending on the target locale.
Return values
stringThe variable rendered as a string.

Implements Erebot\Styling\VariableInterface.

Definition at line 75 of file DateTimeVariable.php.

References Erebot\Styling\Variables\DateTimeVariable\$datetype, Erebot\Styling\Variables\DateTimeVariable\$timetype, Erebot\Styling\Variables\DateTimeVariable\$timezone, and Erebot\IntlInterface\LC_TIME.


The documentation for this class was generated from the following file: