![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/app/bundles/CoreBundle/Factory/ |
<?php declare(strict_types=1); namespace Mautic\CoreBundle\Factory; use Http\Factory\Guzzle\RequestFactory; use Http\Factory\Guzzle\StreamFactory; use Http\Factory\Guzzle\UriFactory; use Mautic\CoreBundle\Helper\CoreParametersHelper; use Mautic\Transifex\Config; use Mautic\Transifex\Exception\InvalidConfigurationException; use Mautic\Transifex\Transifex; use Mautic\Transifex\TransifexInterface; use Psr\Http\Client\ClientInterface; class TransifexFactory { private ?TransifexInterface $transifex = null; public function __construct( private ClientInterface $client, private CoreParametersHelper $coreParametersHelper ) { } /** * @throws InvalidConfigurationException */ public function getTransifex(): TransifexInterface { if (!$this->transifex) { $this->transifex = $this->create($this->client, $this->coreParametersHelper->get('transifex_api_token') ?? ''); } return $this->transifex; } /** * @throws InvalidConfigurationException */ private function create(ClientInterface $client, string $apiToken): TransifexInterface { $config = new Config(); $config->setApiToken($apiToken); $config->setOrganization('mautic'); $config->setProject('mautic'); return new Transifex($client, new RequestFactory(), new StreamFactory(), new UriFactory(), $config); } }