增加对象名称
@param string $name
@param string $poolClassName
@param \Imi\Pool\Interfaces\IPoolConfig $config
@param array|null $resourceConfig
@return void
975186
public static function addName(string $name, string $poolClassName, \Imi\Pool\Interfaces\IPoolConfig $config = null, $resourceConfig = null)
    {
        static::$pools[$name] = BeanFactory::newInstance($poolClassName, $name, $config, $resourceConfig);
        static::$pools[$name]->open();
    }
131876
public static function registerConfig($name, array $config) {
		if( empty($config['path']) ) {
			throw new \Exception('Missing a valid `path` in configuration of route "'.$name.'"');
		}
		if( empty($config['response']) ) {
			$config['response']	= !empty($config['output']) ? static::getOutputResponse($config['output']) : 'Orpheus\InputController\HTTPController\HTMLHTTPResponse';
		}
		if( empty($config['controller']) ) {
			if( !empty($config['redirect']) ) {
				$config['controller'] = 'Orpheus\\Controller\\RedirectController';
			} else
			if( !empty($config['render']) ) {
				$config['controller'] = 'Orpheus\\Controller\\StaticPageController';
			} else {
				throw new \Exception('Missing a valid `controller` in configuration of route "'.$name.'"');
			}
		}
		if( !isset($config['restrictTo']) ) {
			$config['restrictTo'] = null;
		}
		$options = $config;
		unset($options['path'], $options['controller'], $options['method'], $options['restrictTo']);
		static::register($name, $config['path'], $config['controller'], isset($config['method']) ? $config['method'] : null, $config['restrictTo'], $config['response'], $options);
	}
1163648
public static function register(string $name, $config)
    {
        if (\array_key_exists($name, static::$faucets)) {
            throw new ClientAlreadyRegisteredException("[{$name}] is already exists in the sink.");
        }

        static::$configs[$name] = $config;
    }
950641
public function preparePool($classOrName) {
        $queue = new \SplQueue();

        $this->queues[ $classOrName ] = $queue;
        /* @var $bean PoolAble|PoolTrait */
        $bean = Ioc::beanCreate($classOrName, false);
        $config = $bean->poolConfig();
        $bean->_poolName_ = $classOrName;
        $min = $config[ 'min' ];
        $max = $config[ 'max' ];

        $queue->push($bean);
        for ($i = 1; $i < $min; $i++) {
            $bean = Ioc::beanCreate($classOrName, false);
            $bean->_poolName_ = $classOrName;
            $queue->push($bean);
        }
        if (!$max || $max <= $min) {
            $max = $min + 1;
        }

        $chanel = new Channel($max - $min + 1);
        $this->channels[ $classOrName ] = $chanel;
        $buffers = [];
        for ($i = 0; $i < $max - $min; $i++) {
            $buffer = new PoolBuffer($classOrName);
            $chanel->push($buffer);
            $buffers[] = $buffer;
        }
        $this->buffers[ $classOrName ] = $buffers;
        //定时删除
        $idle = $config[ 'idle' ];
        if (!$idle) {
            $idle = 60;
        }
        $check = $config[ 'check' ];
        if (!$check) {
            $check = 30;
        }

        swoole_timer_tick(1000 * $check, function()use($idle) {
            foreach ($this->buffers as $class => $buffer_array) {
                foreach ($buffer_array as $buffer) {
                    /* @var $buffer PoolBuffer */
                    if ($buffer->is_use) {
                        continue;
                    }
                    $time = time() - $buffer->lastActiveTime;
                    if ($time > $idle) {
                        unset($buffer->bean);
                        $buffer->bean = null;
                    }
                }
            }
        });
    }
236358
public function addConnection(array $config, $name = 'default')
    {
        $connections = $this->container['config']['database.connections'];

        $connections[$name] = $config;

        $this->container['config']['database.connections'] = $connections;
    }
385139
public function addResource(ResourceInterface $resource, $name = null) {
		if ($name === null) {
			$this->resources[] = $resource;
			
			return $this;
		}
		
		$this->resources[$name] = $resource;
		
		return $this;
	}
1321911
public void loadConfig(String config)
        throws IOException
    {
        Properties properties = new Properties();
        Resource resource=Resource.newResource(config);
        properties.load(resource.getInputStream());
        
        _jdbcDriver = properties.getProperty("jdbcdriver");
        _url = properties.getProperty("url");
        _userName = properties.getProperty("username");
        _password = properties.getProperty("password");
        _userTable = properties.getProperty("usertable");
        _userTableKey = properties.getProperty("usertablekey");
        _userTableUserField = properties.getProperty("usertableuserfield");
        _userTablePasswordField = properties.getProperty("usertablepasswordfield");
        _roleTable = properties.getProperty("roletable");
        _roleTableKey = properties.getProperty("roletablekey");
        _roleTableRoleField = properties.getProperty("roletablerolefield");
        _userRoleTable = properties.getProperty("userroletable");
        _userRoleTableUserKey = properties.getProperty("userroletableuserkey");
        _userRoleTableRoleKey = properties.getProperty("userroletablerolekey");
        _cacheTime = new Integer(properties.getProperty("cachetime")).intValue();
        
        if (_jdbcDriver == null || _jdbcDriver.equals("")
            || _url == null || _url.equals("")
            || _userName == null || _userName.equals("")
            || _password == null
            || _cacheTime < 0)
        {
            if(log.isDebugEnabled())log.debug("UserRealm " + getName()
                        + " has not been properly configured");
        }
        _cacheTime *= 1000;
        _lastHashPurge = 0;
        _userSql = "select " + _userTableKey + ","
            + _userTablePasswordField + " from "
            + _userTable + " where "
            + _userTableUserField + " = ?";
        _roleSql = "select r." + _roleTableRoleField
            + " from " + _roleTable + " r, "
            + _userRoleTable + " u where u."
            + _userRoleTableUserKey + " = ?"
            + " and r." + _roleTableKey + " = u."
            + _userRoleTableRoleKey;
    }
1309139
protected function loadConnection(OOSSH $oossh, $name, array $config)
    {
        if (!isset($config['host'])) {
            throw new \InvalidArgumentException('Host required');
        }

        $oossh->add($name, new Connection($config['host'], isset($config['port']) ? $config['port'] : 22));

        if (!isset($config['username'])) {
            throw new \InvalidArgumentException('Username required');
        }

        $auth     = null;
        $username = $config['username'];
        if (isset($config['password'])) {
            $auth = new Password($username, $config['password']);
        } else {
            $auth = new PublicKey(
                $username,
                isset($config['pubkey'])     ? $config['pubkey']     : null,
                isset($config['privkey'])    ? $config['privkey']    : null,
                isset($config['passphrase']) ? $config['passphrase'] : null
            );
        }

        $oossh->setAuthentication($name, $auth);
    }
316407
protected function loadConfiguration(Structure $config, $name = null)
    {
        $name = $name ?: $this->getName();

        // Load library config
        $configName = $this->isWeb() ? 'web' : 'console';

        $config->loadFile(__DIR__ . '/../../config/' . $configName . '.php', 'php', ['load_raw' => true]);

        // Load application config
        $file = $this->rootPath . '/etc/app/' . $name . '.php';

        if (is_file($file)) {
            $config->loadFile($file, 'php', ['load_raw' => true]);
        }

        $configs = (array) $config->get('configs', []);

        ksort($configs);

        foreach ($configs as $file) {
            if ($file === false || !is_file($file)) {
                continue;
            }

            $config->loadFile($file, pathinfo($file, PATHINFO_EXTENSION), ['load_raw' => true]);
        }

        $this->container->setParameters($config);
    }
977730
protected function _setResourceName( $name )
	{
		$config = $this->_context->getConfig();

		if( $config->get( 'resource/' . $name ) === null ) {
			$this->_resourceName = $config->get( 'resource/default', 'db' );
		} else {
			$this->_resourceName = $name;
		}
	}
987073
private function addChildNode(string $name, array $config, \XMLWriter $writer): void
    {
        $writer->startElement($name);

        foreach ($config as $nodeName => $nodeData) {
            $nodeName = \is_numeric($nodeName) ? 'num__'.$nodeName : $nodeName;

            if (\is_array($nodeData)) {
                $this->addChildNode($nodeName, $nodeData, $writer);
            } elseif (\is_bool($nodeData)) {
                $writer->writeElement($nodeName, $nodeData === true ? 'true' : 'false');
            } else {
                $writer->writeElement($nodeName, (string)$nodeData);
            }
        }

        $writer->endElement();
    }
864888
public function addClassNamespaces($xAppConfig)
    {
        if($xAppConfig->hasOption('classes') && is_array($xAppConfig->getOption('classes')))
        {
            $aNamespaces = $xAppConfig->getOption('classes');

            // The public methods of the base class must not be exported to javascript
            $protected = array();
            $baseClass = new \ReflectionClass('\\Jaxon\\Sentry\\Armada');
            foreach ($baseClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod)
            {
                $protected[] = $xMethod->getShortName();
            }
            foreach($aNamespaces as $aNamespace)
            {
                // Check mandatory options
                if(!key_exists('directory', $aNamespace) || !key_exists('namespace', $aNamespace))
                {
                    continue;
                }
                // Set the default values for optional parameters
                if(!key_exists('separator', $aNamespace))
                {
                    $aNamespace['separator'] = '.';
                }
                if(!key_exists('protected', $aNamespace))
                {
                    $aNamespace['protected'] = [];
                }
                $this->addClassNamespace($aNamespace['directory'], $aNamespace['namespace'],
                    $aNamespace['separator'], array_merge($aNamespace['protected'], $protected));
            }
        }
    }
527954
public static function register($alias, $config)
    {
        if (is_array($config)) {
            $name = $config['class'];
            $singleton = !empty($config['singleton']);
            unset($config['class'], $config['singleton']);
            static::$classNames[$name] = static::$classAliases[$alias] = [
                'singleton' => $singleton,
                'class' => $name,
                'alias' => $alias,
                'properties' => $config,
            ];
        } elseif (is_callable($config)) {
            static::$classAliases[$alias] = ['class' => $config, 'alias' => $alias, 'properties' => []];
        } else {
            throw new ContainerException('Configuration must be an array or callable.');
        }

        unset(static::$instances[$alias]);
    }
1047665
protected function createUserConfig(ContainerBuilder $container, $name, array $config)
    {
        $tagParams = array(
            'alias' => $name,
            'class' => $config['user_class'],
            'path' => $config['path'],
            'host' => $config['host'],
            'db_driver' => $config['db_driver'],
        );

        if (null !== $config['request_matcher']) {
            $tagParams['request_matcher'] = $config['request_matcher'];
        }

        $def = $container->register('rollerworks_multi_user.user_system.'.$name, 'Rollerworks\Bundle\MultiUserBundle\Model\UserConfig');
        $def
            ->addArgument($this->servicePrefix)
            ->addArgument($this->routesPrefix)
            ->addArgument(new Reference(sprintf('%s.user_manager', $this->servicePrefix)))
            ->addArgument(new Reference(sprintf('%s.group_manager', $this->servicePrefix)))
            ->addMethodCall('setConfig', array('use_listener', $config['use_listener']))
            ->setPublic(false)
            ->addTag('rollerworks_multi_user.user_system', $tagParams)
        ;

        $def->addMethodCall('setTemplate', array('layout', $config['template']['layout']));
        $def->setLazy(true);

        return $def;
    }
1192149
protected function loadExtension($name, $useSettings, Config $config)
    {
        if ($config->hasItem('_loaded', $name)) {
            return $this;
        }

        if (!is_array($useSettings)) {
            $useSettings = [];
        }

        $namespaces = $config->get('namespaces', []);

        if (!is_array($namespaces)) {
            $namespaces = [];
        }

        $namespaces[] = "Itq\\Dev";

        $found = false;

        foreach ($namespaces as $namespace) {
            $pattern = sprintf('%s\\Extension\\{Name}\\{Name}Extension', $namespace);
            $class = str_replace('{Name}', str_replace(' ', '', ucwords(str_replace('-', ' ', $name))), $pattern);
            if (!class_exists($class)) {
                continue;
            }
            $found = $class;
        }

        if (false === $found) {
            throw new \RuntimeException(sprintf("Unknown extension '%s'", $name), 412);
        }

        /** @var ExtensionInterface $extension */
        $extension = new $found($useSettings);

        if (!($extension instanceof ExtensionInterface)) {
            throw new \RuntimeException(
                sprintf("%s must be a valid extension (found: %s)", $name, get_class($extension)),
                412
            );
        }

        $this->addExtension($extension);

        $available = $extension->isAvailable($config);

        if ($available) {
            $r = new \ReflectionClass($extension);
            $config->setDefaultItem('_shell_scripts_dirs', $name, dirname($r->getFileName()).'/Resources/shell-scripts');
            foreach ($extension->getConfigLoaders() as $loader) {
                $loader->load($config);
            }
        }

        $config->setItem('_loaded', $name, $available);

        $this->loadExtensions($config);

        return $this;
    }
15933
public function addCache(CacheItemPoolInterface $cachePool, array $config = [])
    {
        $this->setCachePlugin($cachePool, $config['generator'] ?? null, $config['lifetime'] ?? null);

        $this->setPropertyValue('httpClientModified', true);
    }
1145363
public static function set($name, array $config)
    {
        // 还是没有，那么抛出异常
        if ( ! $config)
        {
            throw new ComponentNotFoundException('The requested component [:component] missing config.', [
                ':component' => $name,
            ]);
        }

        $class = Arr::get($config, 'class');
        if ( ! $class || ! class_exists($class))
        {
            throw new ComponentClassNotFoundException('The requested component class [:class] not found.', [
                ':class' => $class,
            ]);
        }

        /** @var Component $instance */
        $instance = new $class(Arr::get($config, 'params', []));
        foreach (Arr::get($config, 'call', []) as $method => $args)
        {
            call_user_func_array([$instance, $method], $args);
        }

        self::$components[$name] = $instance;
    }