PhpBench\Util\TimeUnit::getDestUnit PHP Method

getDestUnit() public method

Return the destination unit.
public getDestUnit ( string $unit = null ) : string
$unit string
return string
    public function getDestUnit($unit = null)
    {
        // if a unit is given, use that
        if ($unit) {
            return $unit;
        }
        // otherwise return the default
        return $this->destUnit;
    }

Usage Example

示例#1
0
 /**
  * It should use the default values for mode and dest unit if null values are given.
  */
 public function testDefaultValuesModeAndDestUnit()
 {
     $unit = new TimeUnit(TimeUnit::SECONDS, TimeUnit::MINUTES, TimeUnit::MODE_THROUGHPUT);
     $this->assertEquals(TimeUnit::MINUTES, $unit->getDestUnit());
     $this->assertEquals(TimeUnit::MODE_THROUGHPUT, $unit->getMode());
 }