Пример #1
0
 /**
  * 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;
     }
 }
Пример #2
0
 /**
  * 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));
 }