<commit_before><?php

namespace Robo\Common;

/**
 * Wrapper around \Symfony\Component\Console\Helper\ProgressBar
 */
class ProgressIndicator
{
    use Timer;

    /**
     * @var \Symfony\Component\Console\Helper\ProgressBar
     */
    protected $progressBar;

    /**
     * @var \Symfony\Component\Console\Output\OutputInterface
     */
    protected $output;

    /**
     * @var bool
     */
    protected $progressIndicatorRunning = false;

    /**
     * @var int
     */
    protected $autoDisplayInterval = 0;

    /**
     * @var int
     */
    protected $cachedSteps = 0;

    /**
     * @var int
     */
    protected $totalSteps = 0;

    /**
     * @var bool
     */
    protected $progressBarDisplayed = false;

    /**
     * @var \Robo\Contract\TaskInterface
     */
    protected $owner;

    /**
     * @param \Symfony\Component\Console\Helper\ProgressBar $progressBar
     * @param \Symfony\Component\Console\Output\OutputInterface $output
     */
    public function __construct($progressBar, \Symfony\Component\Console\Output\OutputInterface $output)
    {
        $this->progressBar = $progressBar;
        $this->output = $output;
    }

    /**
     * @param int $interval
     */
    public function setProgressBarAutoDisplayInterval($interval)
    {
        if ($this->progressIndicatorRunning) {
            return;
        }
        $this->autoDisplayInterval = $interval;
    }

    /**
     * @return bool
     */
    public function hideProgressIndicator()
    {
        $result = $this->progressBarDisplayed;
        if ($this->progressIndicatorRunning && $this->progressBarDisplayed) {
            $this->progressBar->clear();<commit_msg>Issue #1097 - ProgressIndicator uses the stdError (#1101)<commit_after><?php

namespace Robo\Common;

use Symfony\Component\Console\Output\ConsoleOutputInterface;

/**
 * Wrapper around \Symfony\Component\Console\Helper\ProgressBar
 */
class ProgressIndicator
{
    use Timer;

    /**
     * @var \Symfony\Component\Console\Helper\ProgressBar
     */
    protected $progressBar;

    /**
     * @var \Symfony\Component\Console\Output\OutputInterface
     */
    protected $output;

    /**
     * @var bool
     */
    protected $progressIndicatorRunning = false;

    /**
     * @var int
     */
    protected $autoDisplayInterval = 0;

    /**
     * @var int
     */
    protected $cachedSteps = 0;

    /**
     * @var int
     */
    protected $totalSteps = 0;

    /**
     * @var bool
     */
    protected $progressBarDisplayed = false;

    /**
     * @var \Robo\Contract\TaskInterface
     */
    protected $owner;

    /**
     * @param \Symfony\Component\Console\Helper\ProgressBar $progressBar
     * @param \Symfony\Component\Console\Output\OutputInterface $output
     */
    public function __construct($progressBar, \Symfony\Component\Console\Output\OutputInterface $output)
    {
        $this->progressBar = $progressBar;
        $this->output = $output instanceof ConsoleOutputInterface ?
            $output->getErrorOutput()
            : $output;
    }

    /**
     * @param int $interval
     */
    public function setProgressBarAutoDisplayInterval($interval)
    {
        if ($this->progressIndicatorRunning) {
            return;
        }
        $this->autoDisplayInterval = $interval;
    }

    /**
     * @return bool
     */
    public function hideProgressIndicator()
    {
        $result = $this->progressBarDisplayed;
        if ($this->progressIndicatorRunning && $this->progressBarDisplayed) {
            $this->progressBar->clear();
{'fraction_non_alphanumeric': 0.12732394366197183, 'fraction_numerical': 0.003943661971830986, 'mean_word_length': 2.2194016319129646, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5503845', 'n_tokens_mistral': 1028, 'n_tokens_neox': 1002, 'n_words': 179}