private function __construct() { set_exception_handler(array($this, '_exceptionHandler')); Loader::registerNamespace('Framework', dirname(__FILE__) . DIRECTORY_SEPARATOR); Loader::registerAutoLoad(); $this->_config = Config::getInstance(); }
/** * * @param type $config */ public function __construct($config = null) { \Loader::addNamespacePath('CMS\\', __DIR__ . '/../src/CMS'); Service::set('configuration', function () { return new \Framework\Configuration(); }); Service::get('configuration')->loadFile($config); Service::set('db', function () { return new \Framework\Connection(Service::get('configuration')->get('pdo')); }); Service::set('router', function () { return new \Framework\Router\Router(Service::get('configuration')->get('routes')); }); Service::set('request', function () { return new \Framework\Request\Request(); }); Service::set('security', function () { return new \Framework\Security\Security(); }); Service::set('session', function () { return new \Framework\Session\Session(); }); Service::set('renderer', function () { return new \Framework\Renderer\Renderer(Service::get('configuration')->get('main_layout')); }); Service::get('session'); }
private function __construct() { set_exception_handler(array($this, 'exceptionHandler')); \Framework\Loader::registerNamespace('Framework', dirname(__FILE__) . DIRECTORY_SEPARATOR); \Framework\Loader::registerAutoLoad(); $this->config = \Framework\Config::getInstance(); if ($this->config->getConfigFolder() == null) { $this->setConfigFolder('../config'); } }
public function setConfigFolder($config_folder) { if (!$config_folder) { throw new \Exception("Empty config folder path"); } $_config_folder_realpath = realpath($config_folder); if ($_config_folder_realpath && is_dir($_config_folder_realpath) && is_readable($_config_folder_realpath)) { $this->_config_array = array(); $this->_config_folder = $_config_folder_realpath . DIRECTORY_SEPARATOR; $_namespaces = $this->application['namespaces']; if (is_array($_namespaces)) { \Framework\Loader::registerNamespaces($_namespaces); } } else { throw new \Exception("Config directory read error: " . $config_folder); } }
public function setConfigFolder($configFolder) { if (!$configFolder) { throw new \Exception("Empty config folder path."); } $realConfFolder = realpath($configFolder); if ($realConfFolder != FALSE && is_dir($realConfFolder) && is_readable($realConfFolder)) { $this->configArray = array(); $this->configFolder = $realConfFolder . DIRECTORY_SEPARATOR; $ns = $this->app['namespaces']; if (is_array($ns)) { \Framework\Loader::registerNamespaces($ns); } } else { throw new \Exception("Error Processing Request"); } }
private function __construct() { \Framework\Loader::registerNamespace('Framework', dirname(__FILE__) . DIRECTORY_SEPARATOR); \Framework\Loader::registerAutoload(); $this->_config = \Framework\Config::getInstance(); }
private function _initComponents() { $components = Service::getConfig('components'); foreach ($components as $component) { \Loader::addNamespacePath($component['namespace'], $component['path']); if (isset($component['bootstrap']) && $component['bootstrap'] === 'on') { $class = $component['class']; Service::set($component['name'], new $class()); } } }