Файл: vendor/nunomaduro/termwind/src/Functions.php
Строк: 92
<?php
declare(strict_types=1);
namespace Termwind;
use Closure;
use SymfonyComponentConsoleOutputOutputInterface;
use TermwindRepositoriesStyles as StyleRepository;
use TermwindValueObjectsStyle;
use TermwindValueObjectsStyles;
if (! function_exists('TermwindrenderUsing')) {
/**
* Sets the renderer implementation.
*/
function renderUsing(?OutputInterface $renderer): void
{
Termwind::renderUsing($renderer);
}
}
if (! function_exists('Termwindstyle')) {
/**
* Creates a new style.
*
* @param (Closure(Styles $renderable, string|int ...$arguments): Styles)|null $callback
*/
function style(string $name, ?Closure $callback = null): Style
{
return StyleRepository::create($name, $callback);
}
}
if (! function_exists('Termwindrender')) {
/**
* Render HTML to a string.
*/
function render(string $html, int $options = OutputInterface::OUTPUT_NORMAL): void
{
(new HtmlRenderer)->render($html, $options);
}
}
if (! function_exists('Termwindterminal')) {
/**
* Returns a Terminal instance.
*/
function terminal(): Terminal
{
return new Terminal;
}
}
if (! function_exists('Termwindask')) {
/**
* Renders a prompt to the user.
*
* @param iterable<array-key, string>|null $autocomplete
*/
function ask(string $question, ?iterable $autocomplete = null): mixed
{
return (new Question)->ask($question, $autocomplete);
}
}