Example #1
0
 public function __construct()
 {
     if (!class_exists('Sighhat\\Config')) {
         throw new \InvalidArgumentException('Cannot locate Config class');
     }
     if (!class_exists('Sighhat\\Controller\\Request')) {
         throw new \InvalidArgumentException('Cannot locate Request class');
     }
     if (!class_exists('Sighhat\\Controller\\Response')) {
         throw new \InvalidArgumentException('Cannot locate Response class');
     }
     if (!class_exists('Sighhat\\View\\Base')) {
         throw new \InvalidArgumentException('Cannot locate View class');
     }
     $this->request = $this->asShared(function ($this) {
         return Request::Instance();
     });
     $this->response = $this->asShared(function ($this) {
         return Response::Instance();
     });
     $this->config = $this->asShared(function ($this) {
         return Config::Instance();
     });
     $this->view = $this->asShared(function ($this) {
         return new View(new DIView());
     });
     $this->cache = $this->asShared(function ($this) {
         return Cache::Instance();
     });
     $this->router = $this->asShared(function ($this) {
         return Router::Instance();
     });
 }
Example #2
0
<?php

include LIB_PATH . 'Sighhat/Includes.php';
include 'Includes.php';
use Sighhat\Cache\Base as Cache, Sighhat\Error, Sighhat\Config, Sighhat\Session\Base as Session, Sighhat\Cache\Container\Cache as DICache, Sighhat\Session\Container\Base as DISession, Sighhat\Db\Base as Db, Sighhat\Db\Container\Db as DIDb;
error_reporting(E_ALL | E_STRICT);
function exception_error_handler($errno, $errstr, $errfile, $errline)
{
    ob_clean();
    Error::handle(new Exception($errstr));
}
//set_error_handler("exception_error_handler");
define('CSS_VERSION', 1);
define('JS_VERSION', 1);
define('DEV_ENV', 'development');
define('PROD_ENV', 'production');
define('STAGE_ENV', 'stage');
define('CLI', false);
define('ERROR_LOG', true);
//define('ENV', DEV_ENV);// Dev/Prod switch, pref in apache vhost tbh
Config::Instance(include 'Config.php');
Session::Start(new DISession());
Cache::Instance(new DICache());
Db::Instance(new DIDb());