[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * This file is part of the Symfony package. 5 * 6 * (c) Fabien Potencier <[email protected]> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12 namespace Symfony\Component\Ldap\Adapter; 13 14 use Symfony\Component\OptionsResolver\Options; 15 use Symfony\Component\OptionsResolver\OptionsResolver; 16 17 /** 18 * @author Charles Sarrazin <[email protected]> 19 */ 20 abstract class AbstractConnection implements ConnectionInterface 21 { 22 protected $config; 23 24 public function __construct(array $config = []) 25 { 26 $resolver = new OptionsResolver(); 27 28 $this->configureOptions($resolver); 29 30 $this->config = $resolver->resolve($config); 31 } 32 33 protected function configureOptions(OptionsResolver $resolver) 34 { 35 $resolver->setDefaults([ 36 'host' => 'localhost', 37 'version' => 3, 38 'connection_string' => null, 39 'encryption' => 'none', 40 'options' => [], 41 ]); 42 43 $resolver->setDefault('port', function (Options $options) { 44 return 'ssl' === $options['encryption'] ? 636 : 389; 45 }); 46 47 $resolver->setDefault('connection_string', function (Options $options) { 48 return sprintf('ldap%s://%s:%s', 'ssl' === $options['encryption'] ? 's' : '', $options['host'], $options['port']); 49 }); 50 51 $resolver->setAllowedTypes('host', 'string'); 52 $resolver->setAllowedTypes('port', 'numeric'); 53 $resolver->setAllowedTypes('connection_string', 'string'); 54 $resolver->setAllowedTypes('version', 'numeric'); 55 $resolver->setAllowedValues('encryption', ['none', 'ssl', 'tls']); 56 $resolver->setAllowedTypes('options', 'array'); 57 } 58 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |