PhpBench\Model\ResultCollection::getMetric PHP Method

getMetric() public method

Return the named metric for the given result class.
public getMetric ( string $class, string $metric ) : mixed
$class string
$metric string
return mixed
    public function getMetric($class, $metric)
    {
        $metrics = $this->getResult($class)->getMetrics();
        if (!isset($metrics[$metric])) {
            throw new \InvalidArgumentException(sprintf('Unknown metric "%s" for result class "%s". Available metrics: "%s"', $metric, $class, implode('", "', array_keys($metrics))));
        }
        return $metrics[$metric];
    }