for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
namespace AlecRabbit\Tools;
use AlecRabbit\Tools\Spinner\Contracts\SpinnerInterface;
use AlecRabbit\Tools\Spinner\SnakeSpinner;
class BenchmarkWithSpinner extends Benchmark
{
public function __construct(
int $iterations = 1000,
bool $quiet = false,
SpinnerInterface $spinner = null
) {
parent::__construct($iterations);
$this->advanceSteps = $this->terminalWidth();
// @codeCoverageIgnoreStart
if (!$quiet) {
$s = $spinner ?? new SnakeSpinner('Benchmarking');
$progressStart =
static function () use ($s): void {
echo $s->begin();
};
$progressAdvance =
echo $s->spin();
$progressFinish =
echo $s->end();
$this->showProgressBy($progressStart, $progressAdvance, $progressFinish);
}
// @codeCoverageIgnoreEnd