/** * @internal param \Auryn\Injector $injector * @internal param $category * @return TextResponse */ public function renderCategoryIndex() { $injectionParams = new InjectionParams(); $injectionParams->defineParam('pageTitle', "Imagick demos"); $injectionParams->alias('ImagickDemo\\Navigation\\Nav', 'ImagickDemo\\Navigation\\CategoryNav'); return Tier::renderTemplateExecutable('categoryIndex', $injectionParams); }
public function testExceptionToString() { $exception = new \Exception("This is a testException"); $string = Tier::getExceptionString($exception); //TODO - some assertions. if (class_exists('\\EngineException', false) === true) { try { $foo = new \NonExistentClass(); } catch (\Throwable $t) { $string = Tier::getExceptionString($exception); } } }
use Tier\TierApp; use Tier\TierHTTPApp; use Room11\HTTP\Request\CLIRequest; require_once realpath(__DIR__) . '/../vendor/autoload.php'; // Contains helper functions for the 'framework'. //require __DIR__."/../vendor/danack/tier/src/Tier/tierFunctions.php"; // Contains helper functions for the application. require_once "appFunctions.php"; Tier::setupErrorHandlers(); ini_set('display_errors', 'off'); require __DIR__ . "/../vendor/intahwebz/core/src/Intahwebz/Functions.php"; // Read application config params $injectionParams = (require_once "injectionParams.php"); if (strcasecmp(PHP_SAPI, 'cli') == 0) { $request = new CLIRequest('/Imagick/getImageGeometry', 'phpimagick.com'); } else { $request = Tier::createRequestFromGlobals(); } // Create the first Tier that needs to be run. $routeRequest = new Executable(['Tier\\JigBridge\\Router', 'routeRequest']); // Create the Tier application $app = new TierHTTPApp($injectionParams); $app->createStandardExceptionResolver(); // Make the body that is generated be shared by TierApp $app->addExpectedProduct('Room11\\HTTP\\Body'); $app->addBeforeGenerateBodyExecutable($routeRequest); $app->addInitialExecutable(['ImagickDemo\\AppTimer', 'timerStart']); $app->addAfterSendExecutable(['ImagickDemo\\AppTimer', 'timerEnd']); $app->addSendExecutable(new Executable(['Tier\\Tier', 'sendBodyResponse'])); // Run it $app->execute($request);
public function createResponse() { return Tier::getRenderTemplateTier('admin/fpmStatus'); }
/** * Actually handle the exception. * @param $exception */ private function processException($exception) { Tier::clearOutputBuffer(); //TODO - we are now failing. Replace error handler with instant //shutdown handler. $fallBackHandler = ['Tier\\Tier', 'processException']; if (class_exists('\\Throwable') === true) { $fallBackHandler = ['Tier\\Tier', 'processThrowable']; } $handler = $this->exceptionResolver->getExceptionHandler($exception, $fallBackHandler); try { call_user_func($handler, $exception); } catch (\Exception $e) { Tier::clearOutputBuffer(); // The exception handler function also threw? Just exit. //Fatal error shutdown echo $e->getMessage(); exit(-1); } catch (\Throwable $e) { Tier::clearOutputBuffer(); //Fatal error shutdown echo $e->getMessage(); exit(-1); } }
public function createResponse() { return Tier::renderTemplateExecutable('admin/queueInfo'); }
/** * @param \Exception $e * @return int * @return int */ public static function processThrowable(\Throwable $e) { $exceptionString = Tier::getExceptionString($e); $body = new ExceptionHtmlBody($exceptionString, 500); self::sendRawBodyResponse($body); return \Tier\TierApp::PROCESS_END; }