Prado\Util\TLogRouter::loadConfig PHP Метод

loadConfig() приватный Метод

Loads configuration from an XML element or PHP array
private loadConfig ( $config )
    private function loadConfig($config)
    {
        if (is_array($config)) {
            if (isset($config['routes']) && is_array($config['routes'])) {
                foreach ($config['routes'] as $route) {
                    $properties = isset($route['properties']) ? $route['properties'] : array();
                    if (!isset($route['class'])) {
                        throw new TConfigurationException('logrouter_routeclass_required');
                    }
                    $route = Prado::createComponent($route['class']);
                    if (!$route instanceof TLogRoute) {
                        throw new TConfigurationException('logrouter_routetype_invalid');
                    }
                    foreach ($properties as $name => $value) {
                        $route->setSubproperty($name, $value);
                    }
                    $this->_routes[] = $route;
                    $route->init($route);
                }
            }
        } else {
            foreach ($config->getElementsByTagName('route') as $routeConfig) {
                $properties = $routeConfig->getAttributes();
                if (($class = $properties->remove('class')) === null) {
                    throw new TConfigurationException('logrouter_routeclass_required');
                }
                $route = Prado::createComponent($class);
                if (!$route instanceof TLogRoute) {
                    throw new TConfigurationException('logrouter_routetype_invalid');
                }
                foreach ($properties as $name => $value) {
                    $route->setSubproperty($name, $value);
                }
                $this->_routes[] = $route;
                $route->init($routeConfig);
            }
        }
    }