Archived
1
0
Fork 0
This repository has been archived on 2026-04-03. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
httpcb/app/library/Bootstrap.php

50 lines
1 KiB
PHP

<?php
namespace Httpcb;
use Phalcon\Di\FactoryDefault as DiDefault;
use Phalcon\Di\Injectable;
use Phalcon\DiInterface;
use Phalcon\Mvc\Application;
class Bootstrap extends Injectable
{
public function __construct(DiInterface $di = null)
{
if ($di === null) {
$di = new DiDefault();
}
$this->setDI($di);
}
/**
* Prepares the application to run.
*/
public function prepare()
{
// Force autoloader if registered.
// Should be needed by almost all other services.
$di = $this->getDI();
if ($di->has('loader')) {
$di->get('loader');
}
// If debug is configured. add listener.
if ($di->get('config')->application->debug) {
$di->get('debugger')->listen(true, true);
}
return $this;
}
/**
* Runs the application.
*
* @return string
*/
public function run()
{
$app = new Application($this->getDI());
return $app->handle()->getContent();
}
}