Documentation

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

$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
throws
RuntimeException
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
throws
InvalidArgumentException
Return values
void

setExpires()

public setExpires(DateTime|null $date) : void
Parameters
$date : DateTime|null
Tags
throws
InvalidArgumentException
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
throws
RuntimeException
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
Tags
link
https://bugs.php.net/bug.php?id=75992
throws
InvalidArgumentException

if the argument can't be parsed from a formatted date string

Return values
void

Search results