PHP Class PhpBench\Model\ResultCollection

Show file Open project: dantleech/phpbench Class Usage Examples

Public Methods

Method Description
__construct ( array $results = [] )
getMetric ( string $class, string $metric ) : mixed Return the named metric for the given result class.
getMetricOrDefault ( string $class, string $metric, mixed $default = null ) : mixed Return the named metric or the default value if the *result class* has not been set.
getResult ( string $class ) : PhpBench\Model\ResultInterface Return the result of the given class, throw an exception if it does not exist.
getResults ( ) : PhpBench\Model\ResultInterface[] Return all results.
hasResult ( string $class ) : boolean Return true if there is a result for the given class name.
setResult ( PhpBench\Model\ResultInterface $result ) Add a result to the collection.

Method Details

__construct() public method

public __construct ( array $results = [] )
$results array

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

getMetricOrDefault() public method

If the metric does not exist but the class *does* exist then there is clearly a problem and we should allow an error to be thrown.
public getMetricOrDefault ( string $class, string $metric, mixed $default = null ) : mixed
$class string
$metric string
$default mixed
return mixed

getResult() public method

Return the result of the given class, throw an exception if it does not exist.
public getResult ( string $class ) : PhpBench\Model\ResultInterface
$class string
return PhpBench\Model\ResultInterface

getResults() public method

Return all results.
public getResults ( ) : PhpBench\Model\ResultInterface[]
return PhpBench\Model\ResultInterface[]

hasResult() public method

Return true if there is a result for the given class name.
public hasResult ( string $class ) : boolean
$class string
return boolean

setResult() public method

Only one result per class is permitted.
public setResult ( PhpBench\Model\ResultInterface $result )
$result PhpBench\Model\ResultInterface