/** * Returns the microtime. * * @param bool $get_as_float If true returns timestamp as float, else string * @return mixed The value. * @SuppressWarnings(PHPMD) */ public function getMicrotime($get_as_float = false) { if ($get_as_float) { $converter = new MicrotimeConverter(); return $converter->convertStringToFloat($this->timestamp); } else { return $this->timestamp; } }
/** * Test convertFloatToString(). * * @param float $float The timestamp. * @param string $string The timestamp. * * @test * @dataProvider provideFloatAndStrings */ public function testConvertFloatToString($float, $string) { $converter = new MicrotimeConverter(); $this->assertEquals($string, $converter->convertFloatToString($float)); }