Exemple #1
0
 public static function run()
 {
     try {
         Paths::init();
         Reader::get('app');
         if (!defined('DEV_SHOWERRORS')) {
             define('DEV_SHOWERRORS', false);
         }
         if (!defined('APP_KEY')) {
             define('APP_KEY', 'e77393ef-c24b-4ff5-81f7-ed9fa28b4fb8');
         }
         if (!defined('APP_NAME')) {
             define('APP_NAME', 'sfphp');
         }
         Translations::init();
         Session::get();
         new Launcher();
     } catch (\Exception $err) {
         $errorInfo = sprintf('%s: %s in %s on line %s.', 'Error', $err, $err->getFile(), $err->getLine());
         Debug::dump($errorInfo);
     }
 }
Exemple #2
0
 public function run($argv)
 {
     Paths::init();
     Reader::get('app');
     array_shift($argv);
     $arguments = $argv;
     // It's a petition for an URL registered on system
     if (count($arguments) == 1 and strtolower(trim($arguments[0])) != 'help') {
         new Cli('/' . $arguments[0]);
         return;
     }
     // If it's an internal function on this script
     $command = array_shift($argv);
     $action = array_shift($argv);
     $params = $argv;
     // Check if its an function registered on this script
     // if not launc the cli interface of framework
     if (is_callable(array($this, $command . '_' . $action))) {
         call_user_func_array(array($this, $command . '_' . $action), $params);
     } else {
         echo 'No existe el comando solicitado';
     }
 }