protected function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'host' => 'localhost',
            'version' => 3,
            'connection_string' => null,
            'encryption' => 'none',
            'options' => [],
        ]);

        $resolver->setDefault('port', function (Options $options) {
            return 'ssl' === $options['encryption'] ? 636 : 389;
        });

        $resolver->setDefault('connection_string', function (Options $options) {
            return sprintf('ldap%s://%s:%s', 'ssl' === $options['encryption'] ? 's' : '', $options['host'], $options['port']);
        });

        $resolver->setAllowedTypes('host', 'string');
        $resolver->setAllowedTypes('port', 'numeric');
        $resolver->setAllowedTypes('connection_string', 'string');
        $resolver->setAllowedTypes('version', 'numeric');
        $resolver->setAllowedValues('encryption', ['none', 'ssl', 'tls']);
        $resolver->setAllowedTypes('options', 'array');
    }
protected function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'host' => 'localhost',
            'version' => 3,
            'connection_string' => null,
            'encryption' => 'none',
            'options' => [],
        ]);

        $resolver->setDefault('port', function (Options $options) {
            return 'ssl' === $options['encryption'] ? 636 : 389;
        });

        $resolver->setDefault('connection_string', function (Options $options) {
            return sprintf('ldap%s://%s:%s', 'ssl' === $options['encryption'] ? 's' : '', $options['host'], $options['port']);
        });

        $resolver->setAllowedTypes('host', 'string');
        $resolver->setAllowedTypes('port', 'numeric');
        $resolver->setAllowedTypes('connection_string', 'string');
        $resolver->setAllowedTypes('version', 'numeric');
        $resolver->setAllowedValues('encryption', ['none', 'ssl', 'tls']);
        $resolver->setAllowedTypes('options', 'array');
    }
protected function configureOptions ( OptionsResolver $ resolver ) { $ resolver -> setDefaults ( [ 'host' => 'localhost' , 'version' => 3 , 'connection_string' => null , 'encryption' => 'none' , 'options' => [ ] , ] ) ; $ resolver -> setDefault ( 'port' , function ( Options $ options ) { return 'ssl' === $ options [ 'encryption' ] ? 636 : 389 ; } ) ; $ resolver -> setDefault ( 'connection_string' , function ( Options $ options ) { return sprintf ( 'ldap%s://%s:%s' , 'ssl' === $ options [ 'encryption' ] ? 's' : '' , $ options [ 'host' ] , $ options [ 'port' ] ) ; } ) ; $ resolver -> setAllowedTypes ( 'host' , 'string' ) ; $ resolver -> setAllowedTypes ( 'port' , 'numeric' ) ; $ resolver -> setAllowedTypes ( 'connection_string' , 'string' ) ; $ resolver -> setAllowedTypes ( 'version' , 'numeric' ) ; $ resolver -> setAllowedValues ( 'encryption' , [ 'none' , 'ssl' , 'tls' ] ) ; $ resolver -> setAllowedTypes ( 'options' , 'array' ) ; }
Configures the adapter's options.

@param OptionsResolver $resolver An OptionsResolver instance
Configures the adapter s options .