Create a progress bar

@param  int    $count
@return Symfony\Component\Console\Helper\ProgressBar
177956
protected function progressBar($count)
    {
        if($this->console) {
            return $this->console->getOutput()->createProgressBar($count);
        }
        else {
            return new NullProgressBar;
        }
    }
407858
public function take(int $count): Observable
    {
        if ($count === 0) {
            return self::empty();
        }

        return $this->lift(function () use ($count) {
            return new TakeOperator($count);
        });
    }
888905
public function append($count)
    {
        $bufferLen = strlen($this->buffer);

        if ($bufferLen >= $count + $this->maxAhead) {
            return $bufferLen;
        }

        ($ahead = $this->readAhead)
            && ($delta = $bufferLen - $ahead) < 0
            && $count -= $delta;

        $read = fread($this->handle, $count);
        if ($read === false) {
            throw new UnexpectedValueException(sprintf('Can not deal with fread() errors.'));
        }

        if ($readLen = strlen($read)) {
            $this->buffer .= $read;
            $bufferLen += $readLen;
        }

        return $bufferLen;
    }
126936
public function rewind($count)
    {
        $this->pos -= $count;
        if ($this->pos < 0) {
            $this->pos = 0;
        }

        return $this;
    }
286270
protected function createProgressBar(OutputInterface $output, $length = 10)
    {
        $progress = $this->getHelper('progress');
        $progress->setBarCharacter('<info>|</info>');
        $progress->setEmptyBarCharacter(' ');
        $progress->setProgressCharacter('|');

        $progress->start($output, $length);

        return $progress;
    }
674140
public static function createProgressBar($max = 0, $start = true): ProgressBar
    {
        $bar = new ProgressBar(null, $max);

        if ($start) {
            $bar->start();
        }

        return $bar;
    }
854051
private function getProgressBar(OutputInterface $output, int $total): ProgressBar
    {
        return $this->getProgressBarFactory()->getProgressBar($output, $total);
    }
904138
public static function progressbar( $title, $numerator, $denominator, $line, $time_id = null, $color = 'cyan' ) {
		static $timer = array();
		if( $time_id ) {
			if( !isset($timer[$time_id]) || $timer[$time_id]['last_numerator'] > $numerator ) {
				$timer[$time_id] = array( 'start' => microtime(true) );
			}
			$timer[$time_id]['last_numerator'] = $numerator;
		}

		$text      = $title . ' - ' . self::num_display($numerator) . '/' . self::num_display($denominator);
		$time_text = '';
		if( $time_id ) {
			$diff      = microtime(true) - $timer[$time_id]['start'];
			$time_left = self::formtime(($numerator ? $diff / $numerator : 0) * ($denominator - $numerator));
			$elapsed   = self::formtime($diff);
			if( $diff > 2 ) {
				$time_text = $time_left . " ($elapsed)";
			}
		}
		$width   = max(min(Misc::cols() - strlen($text) - (strlen($time_text) ? : -1) - 6, $denominator), 4);
		$main_xs = floor(($numerator / $denominator) * $width);

		$str = $text . ' [' . Style::$color(str_repeat('#', $main_xs)) . str_repeat('.', $width - $main_xs) . "] " . $time_text;

		Output::line($str, $line);
	}
612500
public function increase( $count = 1 )
    {
        // The attribute is naively incremented, despite possible updates in the DB.
        $this->setAttribute( 'count', $this->attribute( 'count' ) + $count );
        // However, we are not using ->store() here so that we atomatically update
        // the value of the counter in case it has been updated in parallel.
        eZDB::instance()->query(
            "UPDATE ezview_counter " .
            "SET count = count + " . (int)$count . " " .
            "WHERE node_id=" . $this->attribute( "node_id" )
        );
    }
862385
public function display($view, $count = 10)
    {
        $data = $this->calendar->scopeQuery(function ($query) use ($count) {
            return $query->where('status', '<>', 'Draft')->orderBy('id', 'DESC')->take($count);
        })->all();
        return view('calendar::admin.calendar.' . $view, compact('data'));
    }
523548
protected function walkProgress($walkable, $callback, $count = null)
    {
        $isMultiPageCollection = ($walkable instanceof Collection && $walkable->getLastPageNumber() > 1);

        if ($isMultiPageCollection) {
            return $this->walkProgressMultiPage(
                $walkable,
                $callback
            );
        }

        $walkableCount = $count ?: count($walkable);
        $walkableIndex = 0;

        $counterLength = strlen((string)$walkableCount);

        $serializedIndex = serialize(
            $counterLength . '_' . $walkableCount . '_' . microtime()
        );
        $serializedIndexFull = $serializedIndex . '_walkProgress_full';
        $serializedIndexRow = $serializedIndex . '_walkProgress_row';

        $this->timeMessureHelper->start($serializedIndexFull);

        foreach ($walkable as $item) {
            $this->timeMessureHelper->start($serializedIndexRow);

            $walkableIndex++;

            $currentCounter = str_pad($walkableIndex, $counterLength, '0', STR_PAD_LEFT);

            $this->output->write('|- ' . $currentCounter . ' / ' . $walkableCount . ' -> ');

            try {
                $result = $callback($item);

                $this->output->writeln('<comment>' . $result . '</comment> -> <info>' . $this->timeMessureHelper->output($serializedIndexRow) . '</info>');
            } catch (\Exception $exception) {
                $this->output->logException($exception);
                $this->output->logError($this->timeMessureHelper->output($serializedIndexRow));
            }
        }

        $this->output->writeln('');
        $this->output->writeln('<comment>Progress Done!</comment> -> <info>' . $this->timeMessureHelper->output($serializedIndexFull) . '</info>');
    }
1207203
private function setCount(int $count): self
    {
        $this->count = max($count, 0);
        if ($this->count > 0) {
            $this->countPages = (int)ceil($this->count / $this->limit);
        } else {
            $this->countPages = 1;
        }

        return $this;
    }
74888
public function stream_read($count)
    {
        if (self::WRITEONLY === $this->mode) {
            return '';
        }

        if ($this->content->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) {
            return '';
        }

        return $this->content->read($count);
    }
522336
public function seeElementCount($selector, $count)
    {
        $this->assertCount($count, $this->crawler->filter($selector));

        return $this;
    }
330444
public function getLastCommand($count = 1) {
    $retval = array();
    for($i = 0; $i < $count; $i++) {
      $retval[] = array_pop($this->command_history);
    }
    return $retval;
  }
1067225
protected function createImportResults(Import $import, int $count) : void
    {
        $this->out('Preparing records ..');

        $progress = $this->helper('Progress');
        Assert::isInstanceOf($progress, ProgressHelper::class);
        $progress->init();

        $table = TableRegistry::get('CsvMigrations.ImportResults');
        Assert::isInstanceOf($table, ImportResultsTable::class);

        $query = $table->find('all')->where(['import_id' => $import->get('id')]);
        $queryCount = $query->count();

        if ($queryCount >= $count) {
            return;
        }

        $data = [
            'import_id' => $import->get('id'),
            'status' => $table::STATUS_PENDING,
            'status_message' => $table::STATUS_PENDING_MESSAGE,
            'model_name' => $import->get('model_name')
        ];

        $i = $queryCount + 1;
        $progressCount = $count - $queryCount;
        // set $i = 1 to skip header row
        for ($i; $i <= $count; $i++) {
            $data['row_number'] = $i;

            $entity = $table->newEntity();
            $entity = $table->patchEntity($entity, $data);

            $table->save($entity);

            $progress->increment(100 / $progressCount);
            $progress->draw();
        }

        $this->out(null);
    }
515876
public function pop($count = 1)
    {
        $newPath = $this->path->copy();
        for ($i = 0; $i < $count; ++$i) {
            $newPath->pop();
        }

        return $this->replicate(['path' => $newPath]);
    }