LdapTools\Factory\AttributeConverterFactory::getInstanceOfConverter PHP Method

getInstanceOfConverter() protected static method

Load a specific converter if needed and send it back.
protected static getInstanceOfConverter ( string $name ) : LdapTools\AttributeConverter\AttributeConverterInterface
$name string
return LdapTools\AttributeConverter\AttributeConverterInterface
    protected static function getInstanceOfConverter($name)
    {
        try {
            $converter = new self::$converterMap[$name]();
        } catch (\Exception $e) {
            throw new \RuntimeException(sprintf('Unable to load attribute converter "%s": %s', $name, $e->getMessage()));
        }
        if (!$converter instanceof AttributeConverterInterface) {
            throw new \RuntimeException(sprintf('The attribute converter "%s" must implement \\LdapTools\\AttributeConverter\\AttributeConverterInterface.', $name));
        }
        return $converter;
    }