Alex\BehatLauncher\Behat\Run::getProgress PHP Method

getProgress() public method

Returns an array of status progress, as integers.
public getProgress ( string $count = 100 ) : int[]
$count string number of count to distribute
return int[]
    public function getProgress($count = 100)
    {
        $counters = array('pending' => $this->countPending(), 'running' => $this->countRunning(), 'succeeded' => $this->countSucceeded(), 'failed' => $this->countFailed());
        $total = array_sum($counters);
        $ratios = array_map(function ($x) use($total, $count) {
            if ($total === 0) {
                return 0;
            }
            return floor($x * $count / $total);
        }, $counters);
        $extra = $count - array_sum($ratios);
        reset($counters);
        while ($extra > 0 && key($counters)) {
            if ($ratios[key($counters)]) {
                $ratios[key($counters)]++;
                $extra--;
            }
            next($counters);
        }
        return $ratios;
    }