Beispiel #1
0
 /**
  * @param Container $container
  *
  */
 public function __construct(Container $container)
 {
     $this->logger = App::openLog('app.error');
     $this->view = $container['view'];
 }
Beispiel #2
0
<?php

require __DIR__ . '/../vendor/autoload.php';
use Hatchup\Routing\Manager as RoutingManager;
use Hatchup\App;
use Hatchup\App\Exception as AppException;
$config = 'config.ini';
// application specific constants
require __DIR__ . '/../app/constants.php';
$isDevelopment = APPLICATION_ENV == 'development';
try {
    if (!is_writable(LOG_DIR)) {
        throw new AppException(sprintf('Cannot write to log dir (%s)', LOG_DIR));
    }
    $app = new App(['debug' => $isDevelopment], $config);
    // Initialize the Routing Manager
    $routingManager = new RoutingManager($app, [CONTROLLER_DIR], CACHE_DIR . '/routing');
    $routingManager->generateRoutes();
    $app->run();
} catch (\Exception $e) {
    if (is_writable(LOG_DIR)) {
        $log = App::openLog('app.error');
        $log->crit($e);
        echo "<h1>A critical error occured, our apologies for the inconvience.</h1>";
    }
    exit(1);
}