HumanDuration
Table of Contents
Constants
-
HOURS_IN_DAY
= 24
-
MINUTES_IN_HOUR
= 60
-
SECONDS_IN_MINUTE
= 60
Properties
-
$days
: int
-
$hours
: int
-
$hoursPerDay
: int
-
$minutes
: int
-
$seconds
: float
-
$daysRegex
: string
-
$hoursRegex
: string
-
$minutesRegex
: string
-
$secondsRegex
: string
Methods
-
__construct()
: mixed
-
humanize()
: string
-
parse()
: self|false
-
toMinutes()
: float|int
-
toSeconds()
: float|int
-
matchRegex()
: array<string|int, mixed>|null
-
numberBreakdown()
: array<string|int, mixed>
-
parseColonFormattedDuration()
: self
-
parseNumericDuration()
: self
-
parseRegexFormattedDuration()
: self
-
reset()
: void
HOURS_IN_DAY
private
mixed
HOURS_IN_DAY
= 24
MINUTES_IN_HOUR
private
mixed
MINUTES_IN_HOUR
= 60
SECONDS_IN_MINUTE
private
mixed
SECONDS_IN_MINUTE
= 60
$days
public
int
$days
= 0
$hours
public
int
$hours
= 0
$hoursPerDay
public
int
$hoursPerDay
$minutes
public
int
$minutes
= 0
$seconds
public
float
$seconds
= 0.0
$daysRegex
private
string
$daysRegex
= '/([0-9.]+)\s?[dD]/'
$hoursRegex
private
string
$hoursRegex
= '/([0-9.]+)\s?[hH]/'
$minutesRegex
private
string
$minutesRegex
= '/(\d{1,2})\s?[mM]/'
$secondsRegex
private
string
$secondsRegex
= '/(\d{1,2}(\.\d+)?)\s?[sS]/'
__construct()
public
__construct([string|float|int|null $duration = null ][, int $hoursPerDay = self::HOURS_IN_DAY ]) : mixed
Parameters
-
$duration
: string|float|int|null
= null
-
-
$hoursPerDay
: int
= self::HOURS_IN_DAY
-
humanize()
public
humanize([string|float|int|null $duration = null ]) : string
Parameters
-
$duration
: string|float|int|null
= null
-
parse()
public
parse(string|float|int|null $duration) : self|false
Parameters
-
$duration
: string|float|int|null
-
toMinutes()
public
toMinutes([string|float|int|null $duration = null ][, int|false $precision = false ]) : float|int
Parameters
-
$duration
: string|float|int|null
= null
-
-
$precision
: int|false
= false
-
toSeconds()
public
toSeconds([string|float|int|null $duration = null ][, int|false $precision = false ]) : float|int
Parameters
-
$duration
: string|float|int|null
= null
-
-
$precision
: int|false
= false
-
matchRegex()
private
matchRegex(string $regex, string $duration) : array<string|int, mixed>|null
Parameters
-
$regex
: string
-
-
$duration
: string
-
Return values
array<string|int, mixed>|null
numberBreakdown()
private
numberBreakdown(float $number) : array<string|int, mixed>
Parameters
-
$number
: float
-
Return values
array<string|int, mixed>
private
parseColonFormattedDuration(string $duration) : self
Parameters
-
$duration
: string
-
parseNumericDuration()
private
parseNumericDuration(float $duration) : self
Parameters
-
$duration
: float
-
private
parseRegexFormattedDuration(string $duration) : self
Parameters
-
$duration
: string
-
reset()
private
reset() : void