mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-05-31 07:50:08 +00:00
Initial import
This commit is contained in:
25
php/src/Twig/ClassExtension.php
Normal file
25
php/src/Twig/ClassExtension.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace AIO\Twig;
|
||||
|
||||
use Slim\Views\TwigExtension;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
class ClassExtension extends TwigExtension
|
||||
{
|
||||
public function getFunctions() : array
|
||||
{
|
||||
return array(
|
||||
new TwigFunction('class', array($this, 'getClassName')),
|
||||
);
|
||||
}
|
||||
|
||||
public function getClassName($object) : ?string
|
||||
{
|
||||
if (!is_object($object)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return get_class($object);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user