BanEntry
in package
Table of Contents
- $format : string
- $creationDate : DateTime
- $expirationDate : DateTime|null
- $name : string
- $reason : string
- $source : string
- __construct() : mixed
- fromString() : BanEntry|null
- getCreated() : DateTime
- getExpires() : DateTime|null
- getName() : string
- getReason() : string
- getSource() : string
- getString() : string
- hasExpired() : bool
- setCreated() : void
- setExpires() : void
- setReason() : void
- setSource() : void
- parseDate() : DateTime
- validateDate() : void
- Hacky function to validate \DateTime objects due to a bug in PHP. format() with "Y" can emit years with more than 4 digits, but createFromFormat() with "Y" doesn't accept them if they have more than 4 digits on the year.
Properties
$format
public
static string
$format
= "Y-m-d H:i:s O"
$creationDate
private
DateTime
$creationDate
$expirationDate
private
DateTime|null
$expirationDate
= null
$name
private
string
$name
$reason
private
string
$reason
= "Banned by an operator."
$source
private
string
$source
= "(Unknown)"
Methods
__construct()
public
__construct(string $name) : mixed
Parameters
- $name : string
Return values
mixed —fromString()
public
static fromString(string $str) : BanEntry|null
Parameters
- $str : string
Tags
Return values
BanEntry|null —getCreated()
public
getCreated() : DateTime
Return values
DateTime —getExpires()
public
getExpires() : DateTime|null
Return values
DateTime|null —getName()
public
getName() : string
Return values
string —getReason()
public
getReason() : string
Return values
string —getSource()
public
getSource() : string
Return values
string —getString()
public
getString() : string
Return values
string —hasExpired()
public
hasExpired() : bool
Return values
bool —setCreated()
public
setCreated(DateTime $date) : void
Parameters
- $date : DateTime
Tags
Return values
void —setExpires()
public
setExpires(DateTime|null $date) : void
Parameters
- $date : DateTime|null
Tags
Return values
void —setReason()
public
setReason(string $reason) : void
Parameters
- $reason : string
Return values
void —setSource()
public
setSource(string $source) : void
Parameters
- $source : string
Return values
void —parseDate()
private
static parseDate(string $date) : DateTime
Parameters
- $date : string
Tags
Return values
DateTime —validateDate()
Hacky function to validate \DateTime objects due to a bug in PHP. format() with "Y" can emit years with more than 4 digits, but createFromFormat() with "Y" doesn't accept them if they have more than 4 digits on the year.
private
static validateDate(DateTime $dateTime) : void
Parameters
- $dateTime : DateTime