2024-08-04 11:38:18 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Modules\Experience\TwigExtension;
|
|
|
|
|
|
|
|
use Sculpin\Contrib\ProxySourceCollection\ProxySourceItem;
|
|
|
|
use Twig\Extension\AbstractExtension;
|
|
|
|
use Twig\TwigFunction;
|
|
|
|
|
|
|
|
class ExperienceTwigExtension extends AbstractExtension
|
|
|
|
{
|
2024-08-04 11:39:48 +00:00
|
|
|
private static $startYear = 2007;
|
|
|
|
|
2024-08-04 11:38:18 +00:00
|
|
|
public function getFunctions(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
new TwigFunction('get_years_of_experience', [$this, 'getYearsOfExperience']),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName(): string
|
|
|
|
{
|
|
|
|
return 'modules.experience';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getYearsOfExperience(): int
|
|
|
|
{
|
2024-08-04 11:39:48 +00:00
|
|
|
return (new \DateTimeImmutable())->format('Y') - self::$startYear;
|
2024-08-04 11:38:18 +00:00
|
|
|
}
|
|
|
|
}
|