/** * * */ public function __construct() { $connectionOptions = Options::of('database'); try { $this->connection = new \PDO($connectionOptions['dsn'], $connectionOptions['user'], $connectionOptions['pass']); $this->connection->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { $e->getMessage(); } }
/** * Render View * @param string $name * @param array $options * @return string */ public static function make($name, $options = []) { $theme = !isset($options['theme']) ? '_default' : $options['theme']; $title = !isset($options['title']) ? '' : $options['title']; $params = !isset($options['params']) ? [] : $options['params']; $themeOptions = Options::ofTheme($theme); $header = Ui::render(self::themePath($theme, 'header'), $themeOptions['header']); $footer = Ui::render(self::themePath($theme, 'footer'), $themeOptions['footer']); $params['title'] = $title; $content = Ui::render(self::viewPath($name), $params); return Ui::render(self::themePath($theme), ['title' => $title, 'header' => $header, 'footer' => $footer, 'content' => $content, 'assets' => $themeOptions['assets']]); }
/** * @param string $module */ private function setModuleOptions($module) { $this->moduleOptions = Options::ofModule($module); }