private function getOptions() { $this->ensure(file_exists($this->config), 'Файл конфигурации не найден'); $options = simplexml_load_file($this->config); print get_class($options); $dsn = (string) $options->dsn; $this->ensure($options instanceof \SimpleXMLElement, 'Файл конфигурации запорчен'); $this->ensure($dsn, 'DSN не найден'); ApplicationRegistry::setDSN($dsn); $map = new ControllerMap(); foreach ($options->control->view as $default_view) { $stat_str = trim($default_view['status']); $status = Command::statues($stat_str); $map->addView('default', $status, (string) $default_view); } // анализ остальных кодов ApplicationRegistry::setControllerMap($map); }
private function getOptions() { $this->ensure(file_exists($this->config), "Could not find options file"); $options = @SimpleXml_load_file($this->config); // $this->ensure( $options instanceof SimpleXMLElement, // "Could not resolve options file" ); $dsn = (string) $options->dsn; $this->ensure($dsn, "No DSN found"); \woo\base\ApplicationRegistry::setDSN($dsn); $map = new ControllerMap(); foreach ($options->control->view as $default_view) { $stat_str = trim($default_view['status']); $status = \woo\command\Command::statuses($stat_str); $map->addView('default', $status, (string) $default_view); } foreach ($options->control->command as $command_view) { $command = trim((string) $command_view['name']); if ($command_view->classalias) { $classroot = trim((string) $command_view->classalias['name']); $map->addClassroot($command, $classroot); } if ($command_view->view) { $view = trim((string) $command_view->view); $forward = trim((string) $command_view->forward); $map->addView($command, 0, $view); if ($forward) { $map->addForward($command, 0, $forward); } foreach ($command_view->status as $command_view_status) { $view = trim((string) $command_view_status->view); $forward = trim((string) $command_view_status->forward); $stat_str = trim($command_view_status['value']); $status = \woo\command\Command::statuses($stat_str); if ($view) { $map->addView($command, $status, $view); } if ($forward) { $map->addForward($command, $status, $forward); } } } } \woo\base\ApplicationRegistry::setControllerMap($map); }