PhpBench\Model\Benchmark::createSubject PHP Method

createSubject() public method

Create and add a subject.
public createSubject ( string $name ) : Subject
$name string
return Subject
    public function createSubject($name)
    {
        $subject = new Subject($this, $name);
        $this->subjects[$name] = $subject;
        return $subject;
    }

Usage Example

Beispiel #1
0
 private function getSubject(\ArrayObject $context, Benchmark $benchmark, $row)
 {
     $key = $row['run.uuid'] . $row['subject.benchmark'] . $row['subject.name'];
     if (isset($context[self::SUBJECTS][$key])) {
         return $context[self::SUBJECTS][$key];
     }
     $subject = $benchmark->createSubject($row['subject.name']);
     $subject->setSleep($row['variant.sleep']);
     $subject->setOutputTimeUnit($row['variant.output_time_unit']);
     $subject->setOutputTimePrecision($row['variant.output_time_precision']);
     $subject->setOutputMode($row['variant.output_mode']);
     $context[self::SUBJECTS][$key] = $subject;
     $groups = $this->repository->getGroups($row['subject.id']);
     $subject->setGroups($groups);
     return $subject;
 }
All Usage Examples Of PhpBench\Model\Benchmark::createSubject