master

laravel/framework

Last updated at: 29/12/2023 09:21

Alert.php

TLDR

This file defines the Alert class in the Illuminate\Console\View\Components namespace. It extends a Component class and contains a render method that renders the component using the given arguments.

Methods

render

Renders the component using the given arguments. It takes a string and an optional verbosity level as input. The method performs some mutations on the string and then renders a view named 'alert' with the mutated string as the 'content' parameter.

Classes

Class Alert

Represents an alert component that can be rendered using the render method. It extends the Component class and contains logic for rendering the component.

<?php

namespace Illuminate\Console\View\Components;

use Symfony\Component\Console\Output\OutputInterface;

class Alert extends Component
{
    /**
     * Renders the component using the given arguments.
     *
     * @param  string  $string
     * @param  int  $verbosity
     * @return void
     */
    public function render($string, $verbosity = OutputInterface::VERBOSITY_NORMAL)
    {
        $string = $this->mutate($string, [
            Mutators\EnsureDynamicContentIsHighlighted::class,
            Mutators\EnsurePunctuation::class,
            Mutators\EnsureRelativePaths::class,
        ]);

        $this->renderView('alert', [
            'content' => $string,
        ], $verbosity);
    }
}