Skip to content

Commit ef260f0

Browse files
[Ldap] remove needless code
1 parent 3f74921 commit ef260f0

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

Ldap.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Ldap\Adapter\AdapterInterface;
1515
use Symfony\Component\Ldap\Adapter\EntryManagerInterface;
16+
use Symfony\Component\Ldap\Adapter\ExtLdap\Adapter;
1617
use Symfony\Component\Ldap\Adapter\QueryInterface;
1718
use Symfony\Component\Ldap\Exception\DriverNotFoundException;
1819

@@ -23,10 +24,6 @@ final class Ldap implements LdapInterface
2324
{
2425
private $adapter;
2526

26-
private const ADAPTER_MAP = [
27-
'ext_ldap' => 'Symfony\Component\Ldap\Adapter\ExtLdap\Adapter',
28-
];
29-
3027
public function __construct(AdapterInterface $adapter)
3128
{
3229
$this->adapter = $adapter;
@@ -74,12 +71,10 @@ public function escape(string $subject, string $ignore = '', int $flags = 0): st
7471
*/
7572
public static function create(string $adapter, array $config = []): self
7673
{
77-
if (!isset(self::ADAPTER_MAP[$adapter])) {
78-
throw new DriverNotFoundException(sprintf('Adapter "%s" not found. You should use one of: "%s".', $adapter, implode('", "', self::ADAPTER_MAP)));
74+
if ('ext_ldap' !== $adapter) {
75+
throw new DriverNotFoundException(sprintf('Adapter "%s" not found. Only "ext_ldap" is supported at the moment.', $adapter));
7976
}
8077

81-
$class = self::ADAPTER_MAP[$adapter];
82-
83-
return new self(new $class($config));
78+
return new self(new Adapter($config));
8479
}
8580
}

0 commit comments

Comments
 (0)