[Translation] [Loco] Remove SCHEME const

This commit is contained in:
Oskar Stark 2021-04-28 08:48:47 +02:00
parent 69de4d2225
commit 34be4a5120
2 changed files with 4 additions and 5 deletions

View File

@ -48,7 +48,7 @@ final class LocoProvider implements ProviderInterface
public function __toString(): string
{
return sprintf('%s://%s', LocoProviderFactory::SCHEME, $this->endpoint);
return sprintf('loco://%s', $this->endpoint);
}
public function write(TranslatorBagInterface $translatorBag): void

View File

@ -26,7 +26,6 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
*/
final class LocoProviderFactory extends AbstractProviderFactory
{
public const SCHEME = 'loco';
private const HOST = 'localise.biz/api/';
private $client;
@ -47,8 +46,8 @@ final class LocoProviderFactory extends AbstractProviderFactory
*/
public function create(Dsn $dsn): ProviderInterface
{
if (self::SCHEME !== $dsn->getScheme()) {
throw new UnsupportedSchemeException($dsn, self::SCHEME, $this->getSupportedSchemes());
if ('loco' !== $dsn->getScheme()) {
throw new UnsupportedSchemeException($dsn, 'loco', $this->getSupportedSchemes());
}
$endpoint = sprintf('%s%s', 'default' === $dsn->getHost() ? self::HOST : $dsn->getHost(), $dsn->getPort() ? ':'.$dsn->getPort() : '');
@ -64,6 +63,6 @@ final class LocoProviderFactory extends AbstractProviderFactory
protected function getSupportedSchemes(): array
{
return [self::SCHEME];
return ['loco'];
}
}