addUrls example

public function __construct(private readonly iterable $configHandlers)
    {
    }

    public function get(string $key): array
    {
        $filteredUrls = [];
        $customUrls = [];

        foreach ($this->configHandlers as $configHandler) {
            $config = $configHandler->getSitemapConfig();
            $filteredUrls = $this->addUrls($filteredUrls$config[self::EXCLUDED_URLS_KEY]);
            $customUrls = $this->addUrls($customUrls$config[self::CUSTOM_URLS_KEY]);
        }

        if ($key === self::EXCLUDED_URLS_KEY) {
            return $filteredUrls;
        }

        if ($key === self::CUSTOM_URLS_KEY) {
            return $customUrls;
        }

        

    public function get($key)
    {
        $filteredUrls = [];
        $customUrls = [];

        foreach ($this->configHandlers as $configHandler) {
            $config = $configHandler->getSitemapConfig();
            $filteredUrls = $this->addUrls($filteredUrls$config[self::EXCLUDED_URLS_KEY]);
            $customUrls = $this->addUrls($customUrls$config[self::CUSTOM_URLS_KEY]);
        }

        if ($key === self::EXCLUDED_URLS_KEY) {
            return $filteredUrls;
        }

        if ($key === self::CUSTOM_URLS_KEY) {
            return $customUrls;
        }

        
$mediaId = '34556f108ab14969a0dcf9d9522fd7df';
        $mimeType = 'image/png';

        $mediaEntity = new MediaEntity();
        $mediaEntity->setId($mediaId);
        $mediaEntity->setMimeType($mimeType);
        $mediaEntity->setFileExtension('png');
        $mediaEntity->setFileName($mediaId . '-134578345');
        $mediaEntity->setThumbnails(new MediaThumbnailCollection());

        $mediaLoadedEvent = new EntityLoadedEvent($this->getContainer()->get(MediaDefinition::class)[$mediaEntity]$context);
        $subscriber->addUrls($mediaLoadedEvent);

        static::assertStringEndsWith(
            $mediaEntity->getFileName() . '.' . $mediaEntity->getFileExtension(),
            $mediaEntity->getUrl()
        );
        static::assertEquals([]$mediaEntity->getThumbnails()->getElements());
    }

    public function testItAddsThumbnailUrl(): void
    {
        $subscriber = $this->getContainer()->get(MediaLoadedSubscriber::class);
        
Home | Imprint | This part of the site doesn't use cookies.