mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-05-28 14:30:13 +00:00
27 lines
504 B
PHP
27 lines
504 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace AIO\Twig;
|
|
|
|
use Slim\Views\TwigExtension;
|
|
use Twig\TwigFunction;
|
|
|
|
class ClassExtension extends TwigExtension
|
|
{
|
|
#[\Override]
|
|
public function getFunctions() : array
|
|
{
|
|
return array(
|
|
new TwigFunction('class', array($this, 'getClassName')),
|
|
);
|
|
}
|
|
|
|
public function getClassName(mixed $object) : ?string
|
|
{
|
|
if (!is_object($object)) {
|
|
return null;
|
|
}
|
|
|
|
return get_class($object);
|
|
}
|
|
} |