"Fossies" - the Fresh Open Source Software Archive

Member "phpMyAdmin-5.1.0-english/libraries/classes/Twig/MessageExtension.php" (24 Feb 2021, 1129 Bytes) of package /linux/www/phpMyAdmin-5.1.0-english.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "MessageExtension.php" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 5.0.4-english_vs_5.1.0-english.

    1 <?php
    2 
    3 declare(strict_types=1);
    4 
    5 namespace PhpMyAdmin\Twig;
    6 
    7 use PhpMyAdmin\Message;
    8 use Twig\Extension\AbstractExtension;
    9 use Twig\TwigFilter;
   10 
   11 class MessageExtension extends AbstractExtension
   12 {
   13     /**
   14      * Returns a list of filters to add to the existing list.
   15      *
   16      * @return TwigFilter[]
   17      */
   18     public function getFilters()
   19     {
   20         return [
   21             new TwigFilter(
   22                 'notice',
   23                 static function (string $string) {
   24                     return Message::notice($string)->getDisplay();
   25                 },
   26                 ['is_safe' => ['html']]
   27             ),
   28             new TwigFilter(
   29                 'error',
   30                 static function (string $string) {
   31                     return Message::error($string)->getDisplay();
   32                 },
   33                 ['is_safe' => ['html']]
   34             ),
   35             new TwigFilter(
   36                 'raw_success',
   37                 static function (string $string) {
   38                     return Message::rawSuccess($string)->getDisplay();
   39                 },
   40                 ['is_safe' => ['html']]
   41             ),
   42         ];
   43     }
   44 }