Symfony\Component\Console\Helper\ProgressBar::buildLine PHP Method

buildLine() private method

private buildLine ( ) : string
return string
    private function buildLine()
    {
        $regex = "{%([a-z\\-_]+)(?:\\:([^%]+))?%}i";
        $callback = function ($matches) {
            if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) {
                $text = call_user_func($formatter, $this, $this->output);
            } elseif (isset($this->messages[$matches[1]])) {
                $text = $this->messages[$matches[1]];
            } else {
                return $matches[0];
            }
            if (isset($matches[2])) {
                $text = sprintf('%' . $matches[2], $text);
            }
            return $text;
        };
        $line = preg_replace_callback($regex, $callback, $this->format);
        $lineLength = Helper::strlenWithoutDecoration($this->output->getFormatter(), $line);
        $terminalWidth = $this->terminal->getWidth();
        if ($lineLength <= $terminalWidth) {
            return $line;
        }
        $this->setBarWidth($this->barWidth - $lineLength + $terminalWidth);
        return preg_replace_callback($regex, $callback, $this->format);
    }