minor change views; add opcache
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Twig;
|
||||
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFilter;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
class AppExtension extends AbstractExtension
|
||||
{
|
||||
@@ -14,6 +15,13 @@ class AppExtension extends AbstractExtension
|
||||
];
|
||||
}
|
||||
|
||||
public function getFunctions(): array
|
||||
{
|
||||
return [
|
||||
new TwigFunction('enum', [$this, 'enumChecker']),
|
||||
];
|
||||
}
|
||||
|
||||
public function formatPhone(?int $phoneNumber): string
|
||||
{
|
||||
if (!$phoneNumber) {
|
||||
@@ -22,4 +30,9 @@ class AppExtension extends AbstractExtension
|
||||
|
||||
return number_format($phoneNumber, 0,"."," ");
|
||||
}
|
||||
|
||||
public function enumChecker(mixed $currentEnum, string $needEnumName): bool
|
||||
{
|
||||
return $currentEnum->name === $needEnumName;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user