astehlik/typo3-extension-mediaoembed

View on GitHub
Classes/Provider/Endpoint.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

declare(strict_types=1);

namespace Sto\Mediaoembed\Provider;

class Endpoint
{
    private bool $isRegex;

    private string $name;

    private string $url;

    private array $urlSchemes;

    public function __construct(string $name, string $url, bool $isRegex)
    {
        $this->name = $name;
        $this->url = $url;
        $this->isRegex = $isRegex;
        $this->urlSchemes = [];
    }

    public function addUrlScheme(string $urlScheme): void
    {
        $this->urlSchemes[] = $urlScheme;
    }

    public function getName(): string
    {
        return $this->name;
    }

    public function getUrl(): string
    {
        return $this->url;
    }

    public function getUrlConfigKey(): string
    {
        return $this->isRegex() ? 'urlRegexes' : 'urlSchemes';
    }

    public function getUrlSchemes(): array
    {
        return $this->urlSchemes;
    }

    public function isRegex(): bool
    {
        return $this->isRegex;
    }
}