PHP 클래스 Scientist\Experiment

An experiment allows us to implement our code in a new way without risking the introduction of bugs or regressions.
파일 보기 프로젝트 열기: daylerees/scientist 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$chance integer Execution chance.
$control callable The control callback.
$laboratory Laboratory Laboratory instance.
$matcher Scientist\Matchers\Matcher Matcher for experiment values.
$name string Experiment name.
$params array Parameters for our callbacks.
$trials array Trial callbacks.

공개 메소드들

메소드 설명
__construct ( string $name, Laboratory $laboratory ) Create a new experiment.
chance ( integer $chance ) Set the execution chance.
control ( callable $callback ) Register a control callback.
getChance ( ) : integer Get the execution chance.
getControl ( ) : callable Fetch the control callback.
getLaboratory ( ) : Laboratory | null Retrieve the laboratory instance.
getMatcher ( ) : Scientist\Matchers\Matcher Get the matcher for this experiment.
getName ( ) : string Fetch the experiment name.
getParams ( ) : array Get the experiment parameters.
getTrial ( string $name ) : mixed Fetch a trial callback by name.
getTrials ( ) : array Fetch an array of trial callbacks.
matcher ( Scientist\Matchers\Matcher $matcher ) Set a matcher for this experiment.
report ( ) : Report Execute the experiment and return a report.
run ( ) : mixed Execute the experiment within the laboratory.
shouldRun ( ) : boolean Determine whether an experiment should run based on chance.
trial ( string $name, callable $callback ) Register a trial callback.

메소드 상세

__construct() 공개 메소드

Create a new experiment.
public __construct ( string $name, Laboratory $laboratory )
$name string
$laboratory Laboratory

chance() 공개 메소드

Set the execution chance.
public chance ( integer $chance )
$chance integer

control() 공개 메소드

Register a control callback.
public control ( callable $callback )
$callback callable

getChance() 공개 메소드

Get the execution chance.
public getChance ( ) : integer
리턴 integer

getControl() 공개 메소드

Fetch the control callback.
public getControl ( ) : callable
리턴 callable

getLaboratory() 공개 메소드

Retrieve the laboratory instance.
public getLaboratory ( ) : Laboratory | null
리턴 Laboratory | null

getMatcher() 공개 메소드

Get the matcher for this experiment.
public getMatcher ( ) : Scientist\Matchers\Matcher
리턴 Scientist\Matchers\Matcher

getName() 공개 메소드

Fetch the experiment name.
public getName ( ) : string
리턴 string

getParams() 공개 메소드

Get the experiment parameters.
public getParams ( ) : array
리턴 array

getTrial() 공개 메소드

Fetch a trial callback by name.
public getTrial ( string $name ) : mixed
$name string
리턴 mixed

getTrials() 공개 메소드

Fetch an array of trial callbacks.
public getTrials ( ) : array
리턴 array

matcher() 공개 메소드

Set a matcher for this experiment.
public matcher ( Scientist\Matchers\Matcher $matcher )
$matcher Scientist\Matchers\Matcher

report() 공개 메소드

Execute the experiment and return a report.
public report ( ) : Report
리턴 Report

run() 공개 메소드

Execute the experiment within the laboratory.
public run ( ) : mixed
리턴 mixed

shouldRun() 공개 메소드

Determine whether an experiment should run based on chance.
public shouldRun ( ) : boolean
리턴 boolean

trial() 공개 메소드

Register a trial callback.
public trial ( string $name, callable $callback )
$name string
$callback callable

프로퍼티 상세

$chance 보호되어 있는 프로퍼티

Execution chance.
protected int $chance
리턴 integer

$control 보호되어 있는 프로퍼티

The control callback.
protected callable $control
리턴 callable

$laboratory 보호되어 있는 프로퍼티

Laboratory instance.
protected Laboratory,Scientist $laboratory
리턴 Laboratory

$matcher 보호되어 있는 프로퍼티

Matcher for experiment values.
protected Matcher,Scientist\Matchers $matcher
리턴 Scientist\Matchers\Matcher

$name 보호되어 있는 프로퍼티

Experiment name.
protected string $name
리턴 string

$params 보호되어 있는 프로퍼티

Parameters for our callbacks.
protected array $params
리턴 array

$trials 보호되어 있는 프로퍼티

Trial callbacks.
protected array $trials
리턴 array