PhpBench\Model\Variant::getIteration PHP Метод

getIteration() публичный Метод

Return the iteration at the given index.
public getIteration ( $index ) : Iteration
Результат Iteration
    public function getIteration($index)
    {
        return $this->iterations[$index];
    }

Usage Example

Пример #1
0
 private function drawIterations(Variant $variant, array $specials, $tag)
 {
     $this->output->write("");
     // clear line
     $timeUnit = $variant->getSubject()->getOutputTimeUnit();
     $outputMode = $variant->getSubject()->getOutputMode();
     $lines = [];
     $line = sprintf('%-' . self::INDENT . 's', '#' . $variant->getSubject()->getIndex());
     $nbIterations = $variant->count();
     for ($index = 0; $index < $nbIterations; $index++) {
         $iteration = $variant->getIteration($index);
         $displayTime = $this->formatIterationTime($iteration);
         if (isset($specials[$iteration->getIndex()])) {
             $displayTime = sprintf('<%s>%' . $this->colWidth . 's</%s>', $tag, $displayTime, $tag);
         }
         $line .= $displayTime;
         if ($index > 0 && $index < $nbIterations - 1 && ($index + 1) % self::NUMBER_COLS == 0) {
             $lines[] = $line;
             $line = str_repeat(' ', self::INDENT);
         }
     }
     $lines[] = $line;
     $this->currentLine = count($lines) - 1;
     $output = trim(implode(PHP_EOL, $lines));
     $output .= sprintf(' (%s)', $this->timeUnit->getDestSuffix($this->timeUnit->resolveDestUnit($timeUnit), $this->timeUnit->resolveMode($outputMode)));
     $this->output->write(sprintf("%s", $output));
     // clear rest of the line
 }