MediaWiki REL1_37
|
Utility class to parse the TimeCorrection string value. More...
Public Member Functions | |
__construct (string $timeCorrection, DateTime $relativeToDate=null, int $offset=0) | |
__toString () | |
getCorrectionType () | |
Get time offset for a user. | |
getTimeOffset () | |
Get corresponding time offset for this correction Note: When correcting dates/times, apply only the offset OR the time zone, not both. | |
getTimeOffsetInterval () | |
Get corresponding time offset for this correction Note: When correcting dates/times, apply only the offset OR the time zone, not both. | |
getTimeZone () | |
The time zone if known Note: When correcting dates/times, apply only the offset OR the time zone, not both. | |
isValid () | |
Was the original correction specification valid. | |
toString () | |
Note: The string value of this object might not be equal to the original value. | |
Private Member Functions | |
parse (string $timeCorrection) | |
Parse the timecorrection string as stored in the database for a user or as entered into the Preferences form field. | |
Private Attributes | |
$correctionType | |
$date | |
$offset | |
$timeZone | |
$valid | |
Utility class to parse the TimeCorrection string value.
These values are used to specify the time offset for a user and are stored in the database as a user preference and returned by the preferences APIs
The class will correct invalid input and adjusts timezone offsets to applicable dates, taking into account DST etc.
Definition at line 41 of file UserTimeCorrection.php.
MediaWiki\User\UserTimeCorrection::__construct | ( | string | $timeCorrection, |
DateTime | $relativeToDate = null , |
||
int | $offset = 0 |
||
) |
string | $timeCorrection | Original time correction string |
DateTime | null | $relativeToDate | The date used to calculate the time zone offset of. This defaults to the current date and time. |
int | $offset | An offset in minutes (default 0) |
Definition at line 76 of file UserTimeCorrection.php.
References MediaWiki\User\UserTimeCorrection\$offset, and MediaWiki\User\UserTimeCorrection\parse().
MediaWiki\User\UserTimeCorrection::__toString | ( | ) |
Definition at line 249 of file UserTimeCorrection.php.
MediaWiki\User\UserTimeCorrection::getCorrectionType | ( | ) |
Get time offset for a user.
Definition at line 92 of file UserTimeCorrection.php.
MediaWiki\User\UserTimeCorrection::getTimeOffset | ( | ) |
Get corresponding time offset for this correction Note: When correcting dates/times, apply only the offset OR the time zone, not both.
Definition at line 101 of file UserTimeCorrection.php.
MediaWiki\User\UserTimeCorrection::getTimeOffsetInterval | ( | ) |
Get corresponding time offset for this correction Note: When correcting dates/times, apply only the offset OR the time zone, not both.
Definition at line 110 of file UserTimeCorrection.php.
MediaWiki\User\UserTimeCorrection::getTimeZone | ( | ) |
The time zone if known Note: When correcting dates/times, apply only the offset OR the time zone, not both.
Definition at line 124 of file UserTimeCorrection.php.
MediaWiki\User\UserTimeCorrection::isValid | ( | ) |
Was the original correction specification valid.
Definition at line 132 of file UserTimeCorrection.php.
|
private |
Parse the timecorrection string as stored in the database for a user or as entered into the Preferences form field.
There can be two forms of these strings:
string | $timeCorrection |
Definition at line 163 of file UserTimeCorrection.php.
Referenced by MediaWiki\User\UserTimeCorrection\__construct().
MediaWiki\User\UserTimeCorrection::toString | ( | ) |
Note: The string value of this object might not be equal to the original value.
Definition at line 235 of file UserTimeCorrection.php.
|
private |
Definition at line 62 of file UserTimeCorrection.php.
|
private |
Definition at line 56 of file UserTimeCorrection.php.
|
private |
Definition at line 65 of file UserTimeCorrection.php.
Referenced by MediaWiki\User\UserTimeCorrection\__construct().
|
private |
Definition at line 68 of file UserTimeCorrection.php.
|
private |
Definition at line 59 of file UserTimeCorrection.php.