AbstractProviderFactory.php
1 year ago
Dsn.php
1 year ago
FilteringProvider.php
1 year ago
NullProvider.php
1 year ago
NullProviderFactory.php
1 year ago
ProviderFactoryInterface.php
1 year ago
ProviderInterface.php
1 year ago
TranslationProviderCollection.php
1 year ago
TranslationProviderCollectionFactory.php
1 year ago
index.php
1 year ago
AbstractProviderFactory.php
27 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor\Symfony\Component\Translation\Provider; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use MailPoetVendor\Symfony\Component\Translation\Exception\IncompleteDsnException; |
| 5 | abstract class AbstractProviderFactory implements ProviderFactoryInterface |
| 6 | { |
| 7 | public function supports(Dsn $dsn) : bool |
| 8 | { |
| 9 | return \in_array($dsn->getScheme(), $this->getSupportedSchemes(), \true); |
| 10 | } |
| 11 | protected abstract function getSupportedSchemes() : array; |
| 12 | protected function getUser(Dsn $dsn) : string |
| 13 | { |
| 14 | if (null === ($user = $dsn->getUser())) { |
| 15 | throw new IncompleteDsnException('User is not set.', $dsn->getScheme() . '://' . $dsn->getHost()); |
| 16 | } |
| 17 | return $user; |
| 18 | } |
| 19 | protected function getPassword(Dsn $dsn) : string |
| 20 | { |
| 21 | if (null === ($password = $dsn->getPassword())) { |
| 22 | throw new IncompleteDsnException('Password is not set.', $dsn->getOriginalDsn()); |
| 23 | } |
| 24 | return $password; |
| 25 | } |
| 26 | } |
| 27 |