You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
676 B

<?php
declare(strict_types=1);
namespace App\Twig\Components;
use Psr\Cache\InvalidArgumentException;
use Symfony\Contracts\Cache\CacheInterface;
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
#[AsTwigComponent]
class Header
{
public array $cats;
/**
* @throws InvalidArgumentException
*/
public function __construct(private readonly CacheInterface $cache)
{
$mag = $this->cache->get('magazine-newsroom-magazine-by-newsroom', function (){
return null;
});
$tags = $mag->getTags();
$this->cats = array_filter($tags, function($tag) {
return ($tag[0] === 'a');
});
}
}