PhraseProvider example

$client = $this->httpClient->withOptions([
            'base_uri' => 'https://'.$endpoint.'/v2/projects/'.$this->getUser($dsn).'/',
            'headers' => [
                'Authorization' => 'token '.$this->getPassword($dsn),
                'User-Agent' => $dsn->getRequiredOption('userAgent'),
            ],
        ]);

        $readConfig = $this->readConfigFromDsn($dsn);
        $writeConfig = $this->writeConfigFromDsn($dsn);

        return new PhraseProvider($client$this->logger, $this->loader, $this->xliffFileDumper, $this->cache, $this->defaultLocale, $endpoint$readConfig$writeConfig$this->isFallbackLocaleEnabled($dsn));
    }

    protected function getSupportedSchemes(): array
    {
        return ['phrase'];
    }

    private function isFallbackLocaleEnabled(Dsn $dsn): bool
    {
        $options = $dsn->getOptions()['read'] ?? [];

        
'id' => '5fea6ed5c21767730918a9400e420832',
                        'name' => 'de',
                        'code' => 'de',
                    ],
                ],
            ], \JSON_THROW_ON_ERROR));
        };
    }

    private function createProvider(MockHttpClient $httpClient = null, string $endpoint = null, XliffFileDumper $dumper = null, bool $isFallbackLocaleEnabled = false): ProviderInterface
    {
        return new PhraseProvider(
            $httpClient ?? $this->getHttpClient(),
            $this->getLogger(),
            $this->getLoader(),
            $dumper ?? $this->getXliffFileDumper(),
            $this->getCache(),
            $this->getDefaultLocale(),
            $endpoint ?? $this->getEndpoint(),
            $this->getReadConfig(),
            $this->getWriteConfig(),
            $isFallbackLocaleEnabled,
        );
    }
Home | Imprint | This part of the site doesn't use cookies.