public function addSubsidiaryClass($name, $config)
    {
        if (!is_string($name) || empty($name)) {
            throw new InvalidConfigException('Subsidiary name not specified.');
        }
        $name = strtolower($name);
        if (!is_array($config)) {
            if (is_string($config) && !empty($config)) {
                $this->subsidiaryMap[$name] = ['class' => $config];
            } else {
                throw new InvalidConfigException('Subsidiary class not specified.');
            }
        } else {
            if (isset($config['class']) && class_exists($config['class'])) {
                $this->subsidiaryMap[$name] = $config;
            } else {
                throw new InvalidConfigException('Subsidiary class not specified.');
            }
        }
        return true;
    }
public function addSubsidiaryClass($name, $config)
    {
        if (!is_string($name) || empty($name)) {
            throw new InvalidConfigException('Subsidiary name not specified.');
        }
        $name = strtolower($name);
        if (!is_array($config)) {
            if (is_string($config) && !empty($config)) {
                $this->subsidiaryMap[$name] = ['class' => $config];
            } else {
                throw new InvalidConfigException('Subsidiary class not specified.');
            }
        } else {
            if (isset($config['class']) && class_exists($config['class'])) {
                $this->subsidiaryMap[$name] = $config;
            } else {
                throw new InvalidConfigException('Subsidiary class not specified.');
            }
        }
        return true;
    }
public function addSubsidiaryClass ( $ name , $ config ) { if ( ! is_string ( $ name ) || empty ( $ name ) ) { throw new InvalidConfigException ( 'Subsidiary name not specified.' ) ; } $ name = strtolower ( $ name ) ; if ( ! is_array ( $ config ) ) { if ( is_string ( $ config ) && ! empty ( $ config ) ) { $ this -> subsidiaryMap [ $ name ] = [ 'class' => $ config ] ; } else { throw new InvalidConfigException ( 'Subsidiary class not specified.' ) ; } } else { if ( isset ( $ config [ 'class' ] ) && class_exists ( $ config [ 'class' ] ) ) { $ this -> subsidiaryMap [ $ name ] = $ config ; } else { throw new InvalidConfigException ( 'Subsidiary class not specified.' ) ; } } return true ; }
Add subsidiary class to map.
@param string $name Subsidiary name, case insensitive.
@param string|array $config If this parameter is string, it will regarded as class name.
If this parameter is array, you should specify `class`, and the class should be existed.
@return boolean True if the class added.
@throws InvalidConfigException throws if subsidiary name is not specified or class is not
specified.
Add subsidiary class to map .