<?php


namespace App\Twig;


use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

class HelpersExtension extends AbstractExtension
{
    public function getFunctions()
    {
        return [
            new TwigFunction('fa', function($icon, $pack = 'regular') {
                $pack = [
                    'regular' => 'far',
                    'solid'   => 'fas',
                    'brand'   => 'fab',
                    'light'   => 'fal'
                ][$pack] ?? 'fa';

                return "$pack fa-$icon";
            })
        ];
    }
}
