Format and write message to terminal. like printf()
@param string $format
@param mixed  ...$args
@return int
195316
public static function writef(string $format, ...$args): int
    {
        return self::write(\sprintf($format, ...$args));
    }
98126
public static void printWarn(Object caller, String format, Object... args)
	{
		Object msg = String.format(format, args);
		
		printWarn(caller,msg);
	}
183545
public function in($format = '')
    {
        if (empty($format)) {
            $line = fgets(STDIN);
        } else {
            $line = fscanf(STDIN, $format . PHP_EOL, $line);
        }

        return trim($line);
    }
1014072
public function setFormat($format = null)
    {
        if ( ! is_null($format)) {
            self::checkFormat($format);
            $this->format = $format;
        }

        return $this;
    }
720300
public static function debug(string $format)
    {
        if (!is_resource(self::$debug_stream))
            self::$debug_stream = fopen('php://output', 'w');

        $args = func_get_args();
        foreach ($args as $idx => &$arg)
        {
            if ($idx === 0)
                $arg .= PHP_SAPI === 'cli' ? "\n" : "<br>\n";

            if (!is_scalar($arg))
                $arg = static::str($arg);
        }

        array_unshift($args, self::$debug_stream);
        call_user_func_array('fprintf', $args);
    }
168711
public function write($format = 'rtf')
	{
		$string = '';
		
		// if $format is a string
		if (is_string($format)) {
			$writer = new Writer();
			$string = $writer->write($this->root, $format);	
		} else {
			throw new \InvalidArgumentException(
				__METHOD__."() expects parameter one, format, to be a string"
			);
		}
		
		return $string;
	}
889931
public function setFormat($format)
    {
        if ($this->app['debug']) {
            if (false === is_string($format)) {
                throw new \InvalidArgumentException(sprintf('Format must be a string, got "%s".', is_object($format) ? get_class($format) : gettype($format)));
            }

            if (false === strpos($format, '%key%')) {
                throw new \InvalidArgumentException(sprintf('Format must contain "%%key%%", got "%s".', $format));
            }

            if (false === strrpos($format, '.')) {
                throw new \InvalidArgumentException(sprintf('Format missing extension, got "%s".', $format));
            }
        }

        $this->format = $format;

        if (strlen($format) > 5 && '.dist' === substr($format, -5)) {
            $format = substr($format, strrpos($format, '.', -6) + 1);
        } else {
            $format = substr($format, strrpos($format, '.') + 1);
        }

        switch ($format) {
            case 'json':
            case 'json.dist':
                $this->loader = new JsonLoader();
                break;
            case 'yml':
            case 'yml.dist':
            case 'yaml':
            case 'yaml.dist':
                if (false === class_exists('Symfony\\Component\\Yaml\\Yaml')) {
                    throw new \RuntimeException('Missing Symfony Yaml component.');
                }

                $this->loader = new YamlLoader();
                break;
            case 'php':
            case 'php.dist':
                $this->loader = new PHPLoader();
                break;
            default:
                throw new \InvalidArgumentException(sprintf('Unsupported file format "%s".', $format));
        }

        $this->flushAll();

        return $this;
    }
369271
protected function callFunction($prefix, $format, array $arguments)
    {
        $function = "$prefix$format";

        if (!in_array($format, $this->getSupportedFormats())) {
            throw new RuntimeException("Unsupported image format $format");
        }

        if (!function_exists($function)) {
            throw new BadFunctionCallException("Function $function does not exist");
        }

        return call_user_func_array($function, $arguments);
    }
19951
public function format($format = null)
    {
        if (func_num_args()) {
            return parent::format($format);
        }
        if ($this->_format === null) {
            $this->negotiate();
        }
        return $this->_format;
    }
55903
public static function formatTranslate(string $text, array $args): string
    {
        if ($args === []) {
            return $text;
        }

        return \is_array($args[0]) ? \strtr($text, $args[0]) : \vsprintf($text, $args);
    }
1284254
public function format($format)
    {
        $string = str_replace(' ', '', $this->value());
        for ($i = 0; $i < strlen($string); $i++) {
            $pos = strpos($format, '#');

            // verificar se string eh maior que a qtdade de #.
            if ($pos === false) {
                break;
            }
            $format[$pos] = $string[$i];
        }

        // verificar se sobrou # para trocar
        if (strpos($format, '#') !== false) {
            $format = $this->value();
        }

        $this->value = $format;

        return $this;
    }
967614
public function convert(string $outputFile, string $format, array $params = array()): ExportResult
    {
        try {
            $this->getVerb()->setOutputFile($outputFile)
                ->setFormat($format)
                ->setParameters($params);

            $result = self::getCommand()->execute($this->getVerb());
            if (!$result->isSuccess()) {
                if ($result->hasException()) {
                    throw $result->getException();
                }
                throw new \RuntimeException('Unknown error: ', $result->getExitCode());
            }
            return $result;
        } catch (\Exception $e) {
            throw new ConverterException('Conversion failed', ErrorCodes::EXECUTION_FAILURE, $e);
        }
    }
268328
private function formatEcho(Format $format, $args)
    {
        foreach ($args as $group => $list) {
            if (is_array($list)) {
                $this->writeln($format->format($group));
                foreach ($list as $name => $desc) {
                    $this->writeln($format->format('  ' . $name . str_repeat(' ', $this->commandLength - 2 - strlen($name)) . $desc));
                }
            } else {
                $this->writeln($format->format($group . str_repeat(' ', $this->commandLength - strlen($group)) . $list));
            }
        }
    }
760217
public static function format($format, ...$args): self
    {
        Assert::typeOf(['string', __CLASS__], $format);

        return new static(sprintf((string) $format, ...$args));
    }
729063
function printFormatted(string $format): int {
		$args = func_get_args ();
		$s = call_user_func_array ( 'sprintf', $args );
		return $this->write ( $s );
	}
632319
public function setFormat($format)
    {
        if (in_array($format, TextFormat::asArray()) === true) {
            $this->format = $format;
        } else {
            $msg = "The 'format' argument must be a value from the TextFormat enumeration, '" . gettype($format) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
1145655
public function setMessage($tag, $args = array())
    {
        if (!is_array($args)) {
            $args = array($args);
        }
        $fmt = $this->app->_($this->get($tag));

        // Try to analyze format and see which formatter to use
        if (class_exists('MessageFormatter', false) && strpos($fmt, '{') !== null) {
            $fmt = new MessageFormatter($this->app->locale, $fmt);
            $str = $fmt->format($args);
        } elseif (strpos($fmt, '%') !== null) {
            // Else, perhaps it's a sprintf?
            array_unshift($args, $fmt);
            $str = call_user_func_array('sprintf', $args);
        } else {
            throw $this->exception('Unclear how to format this')
                ->addMoreInfo('fmt', $fmt)
                ;
        }

        return $this->set($tag, $str);
    }