<?php 
 
include dirname(__DIR__).'/vendor/autoload.php'; 
include __DIR__.'/config/loader.php'; 
 
$cmd = new CMP\Console(); 
 
function myErrorHandler($errno, $errstr, $errfile, $errline) { 
   global $cmd; 
   $description = ''; 
    switch ($errno) { 
      case E_ERROR: 
      case E_CORE_ERROR: 
      case E_COMPILE_ERROR: 
      case E_USER_ERROR: 
         $description = "<error> ERROR </error> $errstr\n"; 
         $description .= "  Fatal error on line <info>$errline</info> in file <info>$errfile</info>"; 
         $description .= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")\n"; 
         $description .= "Aborting...\n"; 
         break; 
 
      case E_WARNING: 
      case E_USER_WARNING: 
         $description = "<warning> WARNING </warning> $errstr\n"; 
         $description .= "  on line <info>$errline</info> in file <info>$errfile</info>"; 
         $description .= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")\n"; 
         break; 
 
      case E_NOTICE: 
      case E_USER_NOTICE: 
      $description = "<warning> NOTICE </warning> $errstr\n"; 
      $description .= "  on line <info>$errline</info> in file <info>$errfile</info>"; 
      $description .= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")\n"; 
         break; 
 
      default: 
      return false; 
         break; 
    } 
 
    $cmd->writeln($description); 
    /* Don't execute PHP internal error handler */ 
    return true; 
} 
 
$old_error_handler = set_error_handler("myErrorHandler"); 
 
$cmd->register('environment', new \Console\Commands\Environment); 
$cmd->register('dump-routes', new \Console\Commands\DumpRoutes); 
$cmd->alias('environment', 'env'); 
$cmd->register('build', new \Console\Commands\Build); 
$cmd->register('test-email', new \Console\Commands\TestEmail); 
 
 
try { 
   $cmd->run(); 
} catch (\Exception $e) { 
   $cmd->writeln("Exception: <error>{$e->getMessage()}</error>"); 
   exit(1); 
} 
 
exit(0);
 
 |