PHP Class phpmock\functions\FixedMicrotimeFunction

Author: Markus Malkusch ([email protected])
Inheritance: implements phpmock\functions\FunctionProvider, implements phpmock\functions\Incrementable
Show file Open project: php-mock/php-mock Class Usage Examples

Public Methods

Method Description
__construct ( mixed $timestamp = null ) Set the timestamp.
getCallable ( ) : callable Returns this object as a callable for the mock function.
getMicrotime ( boolean $get_as_float = false ) : mixed Returns the microtime.
getTime ( ) : integer Returns the time without the microseconds.
increment ( $increment )
setMicrotime ( string $timestamp ) Set the timestamp as string.
setMicrotimeAsFloat ( float $timestamp ) Set the timestamp as float.

Method Details

__construct() public method

Set the timestamp.
public __construct ( mixed $timestamp = null )
$timestamp mixed The timestamp, if ommited the current time.

getCallable() public method

Returns this object as a callable for the mock function.
public getCallable ( ) : callable
return callable The callable for this object.

getMicrotime() public method

Returns the microtime.
public getMicrotime ( boolean $get_as_float = false ) : mixed
$get_as_float boolean If true returns timestamp as float, else string
return mixed The value.

getTime() public method

Returns the time without the microseconds.
public getTime ( ) : integer
return integer The time.

increment() public method

public increment ( $increment )

setMicrotime() public method

Set the timestamp as string.
public setMicrotime ( string $timestamp )
$timestamp string The timestamp as string.

setMicrotimeAsFloat() public method

Set the timestamp as float.
public setMicrotimeAsFloat ( float $timestamp )
$timestamp float The timestamp as float.