Scientist\Laboratory::runExperiment PHP Method

runExperiment() public method

Run an experiment.
public runExperiment ( Experiment $experiment ) : mixed
$experiment Experiment
return mixed
    public function runExperiment(Experiment $experiment)
    {
        if ($experiment->shouldRun()) {
            $report = $this->getReport($experiment);
            return $report->getControl()->getValue();
        }
        return call_user_func_array($experiment->getControl(), $experiment->getParams());
    }

Usage Example

 /**
  * Execute the experiment within the laboratory.
  *
  * @return mixed
  */
 public function run()
 {
     $this->params = func_get_args();
     if ($this->laboratory) {
         return $this->laboratory->runExperiment($this);
     }
     return call_user_func($this->control, $this->params);
 }
All Usage Examples Of Scientist\Laboratory::runExperiment