Пример #1
0
 /**
  * Creates a new runner
  *
  */
 protected function newRunner($profile = null)
 {
     $r = new Runner('/var/www', $profile);
     // The debug application
     $r->mapApplication('/debug', (new \xp\scriptlet\WebApplication('debug'))->withScriptlet(self::$debugScriptlet->getName())->withConfig($r->expand('{WEBROOT}/etc/{PROFILE}'))->withEnvironment(['DOMAIN' => 'example.com', 'ADMINS' => 'admin@example.com,root@localhost'])->withArguments(['Debugging', 'today']));
     // The error application
     $r->mapApplication('/error', (new \xp\scriptlet\WebApplication('error'))->withScriptlet(self::$errorScriptlet->getName())->withConfig($r->expand('{WEBROOT}/etc'))->withDebug('dev' === $profile ? \xp\scriptlet\WebDebug::XML | \xp\scriptlet\WebDebug::ERRORS | \xp\scriptlet\WebDebug::STACKTRACE | \xp\scriptlet\WebDebug::TRACE : \xp\scriptlet\WebDebug::NONE));
     // The incomplete app (missing a scriptlet)
     $r->mapApplication('/incomplete', (new \xp\scriptlet\WebApplication('incomplete'))->withScriptlet(null)->withDebug(\xp\scriptlet\WebDebug::STACKTRACE));
     // The XML application
     $r->mapApplication('/xml', (new \xp\scriptlet\WebApplication('xml'))->withScriptlet(self::$xmlScriptlet->getName())->withDebug('dev' === $profile ? \xp\scriptlet\WebDebug::XML : \xp\scriptlet\WebDebug::NONE));
     // The exit scriptlet
     $r->mapApplication('/exit', (new \xp\scriptlet\WebApplication('exit'))->withScriptlet(self::$exitScriptlet->getName()));
     // The not found application with default error level (error)
     $r->mapApplication('/notfounderror', (new WebApplication('notfounderror'))->withScriptlet(self::$notFoundScriptlet->getName()));
     // The not found application with error level warn
     $r->mapApplication('/notfoundwarn', (new WebApplication('notfoundwarn'))->withScriptlet(self::$notFoundScriptlet->getName())->withLogLevel(HttpConstants::STATUS_NOT_FOUND, 'warn'));
     // The welcome application
     $r->mapApplication('/', (new \xp\scriptlet\WebApplication('welcome'))->withScriptlet(self::$welcomeScriptlet->getName())->withConfig($r->expand('{WEBROOT}/etc'))->withDebug('dev' === $profile ? \xp\scriptlet\WebDebug::XML | \xp\scriptlet\WebDebug::ERRORS | \xp\scriptlet\WebDebug::STACKTRACE : \xp\scriptlet\WebDebug::NONE));
     return $r;
 }
Пример #2
0
 /**
  * Creates a new runner
  *
  */
 protected function newRunner($profile = null)
 {
     $r = new Runner('/var/www', $profile);
     // The debug application
     $r->mapApplication('/debug', create(new \xp\scriptlet\WebApplication('debug'))->withScriptlet(self::$debugScriptlet->getName())->withConfig($r->expand('{WEBROOT}/etc/{PROFILE}'))->withEnvironment(array('DOMAIN' => 'example.com', 'ADMINS' => 'admin@example.com,root@localhost'))->withArguments(array('Debugging', 'today')));
     // The error application
     $r->mapApplication('/error', create(new \xp\scriptlet\WebApplication('error'))->withScriptlet(self::$errorScriptlet->getName())->withConfig($r->expand('{WEBROOT}/etc'))->withDebug('dev' === $profile ? \xp\scriptlet\WebDebug::XML | \xp\scriptlet\WebDebug::ERRORS | \xp\scriptlet\WebDebug::STACKTRACE | \xp\scriptlet\WebDebug::TRACE : \xp\scriptlet\WebDebug::NONE));
     // The incomplete app (missing a scriptlet)
     $r->mapApplication('/incomplete', create(new \xp\scriptlet\WebApplication('incomplete'))->withScriptlet(null)->withDebug(\xp\scriptlet\WebDebug::STACKTRACE));
     // The XML application
     $r->mapApplication('/xml', create(new \xp\scriptlet\WebApplication('xml'))->withScriptlet(self::$xmlScriptlet->getName())->withDebug('dev' === $profile ? \xp\scriptlet\WebDebug::XML : \xp\scriptlet\WebDebug::NONE));
     // The exit scriptlet
     $r->mapApplication('/exit', create(new \xp\scriptlet\WebApplication('exit'))->withScriptlet(self::$exitScriptlet->getName()));
     // The welcome application
     $r->mapApplication('/', create(new \xp\scriptlet\WebApplication('welcome'))->withScriptlet(self::$welcomeScriptlet->getName())->withConfig($r->expand('{WEBROOT}/etc'))->withDebug('dev' === $profile ? \xp\scriptlet\WebDebug::XML | \xp\scriptlet\WebDebug::ERRORS | \xp\scriptlet\WebDebug::STACKTRACE : \xp\scriptlet\WebDebug::NONE));
     return $r;
 }