PHP Class business\Time

Author: Florian Voutzinos ([email protected])
Inheritance: implements JsonSerializable
显示文件 Open project: florianv/business Class Usage Examples

Public Methods

Method Description
__construct ( string | integer $hours, string | integer $minutes, string | integer $seconds ) Creates a new time.
fromDate ( DateTime $date ) : Time Creates a new time from a date.
fromString ( string $time ) : Time Creates a new time from a string.
getHours ( ) : integer Gets the hours.
getMinutes ( ) : integer Gets the minutes.
getSeconds ( ) : integer Gets the seconds.
isAfterOrEqual ( Time $other ) : boolean Checks if this time is after or equal to an other time.
isBeforeOrEqual ( Time $other ) : boolean Checks if this time is before or equal to an other time.
jsonSerialize ( )
toInteger ( ) : integer Returns an integer representation of the time.
toString ( ) : integer Returns an integer representation of the time.

Method Details

__construct() public method

Creates a new time.
public __construct ( string | integer $hours, string | integer $minutes, string | integer $seconds )
$hours string | integer
$minutes string | integer
$seconds string | integer Optional seconds

fromDate() public static method

Creates a new time from a date.
public static fromDate ( DateTime $date ) : Time
$date DateTime
return Time

fromString() public static method

Creates a new time from a string.
public static fromString ( string $time ) : Time
$time string
return Time

getHours() public method

Gets the hours.
public getHours ( ) : integer
return integer

getMinutes() public method

Gets the minutes.
public getMinutes ( ) : integer
return integer

getSeconds() public method

Gets the seconds.
public getSeconds ( ) : integer
return integer

isAfterOrEqual() public method

Checks if this time is after or equal to an other time.
public isAfterOrEqual ( Time $other ) : boolean
$other Time
return boolean

isBeforeOrEqual() public method

Checks if this time is before or equal to an other time.
public isBeforeOrEqual ( Time $other ) : boolean
$other Time
return boolean

jsonSerialize() public method

public jsonSerialize ( )

toInteger() public method

Returns an integer representation of the time.
public toInteger ( ) : integer
return integer

toString() public method

Returns an integer representation of the time.
public toString ( ) : integer
return integer