#1 | Phalcon\Mvc\Application->handle()
/var/www/hosting/ndb.by/backend/App.php (47) <?php
namespace Backend;
use Phalcon\DiInterface;
use Phalcon\Mvc\Application;
use Phalcon\Mvc\Router;
class App
{
/**
* @var \Phalcon\DiInterface
*/
private $_di;
/**
* @var \Phalcon\Mvc\Application
*/
private $_application;
/**
* @var \Phalcon\Config
*/
private $_config;
/**
* App constructor.
*
* @param $_dependencyInjector
*/
public function __construct(DiInterface $_dependencyInjector)
{
$this->_di = $_dependencyInjector;
$this->_config = $_dependencyInjector->get('config');
$this->createPhalconApplication();
$this->registerRoutes();
$this->registerServices();
}
/**
* @return string
*/
public function getContent()
{
return $this->_application->handle()->getContent();
}
/**
* @return \Phalcon\Mvc\Application
*/
private function createPhalconApplication()
{
/**
* Приложение
*/
$this->_application = new Application($this->_di);
/**
* Регистрация установленных модулей
*/
$this->_application->registerModules([
'admin' => [
'className' => 'Backend\Modules\Admin\Module',
],
'site' => [
'className' => 'Backend\Modules\Site\Module',
],
'api' => [
'className' => 'Backend\Modules\API\Module',
],
]);
return $this->_application;
}
private function registerRoutes()
{
/**
* Registering a router
*/
$this->_di->set('router', function () {
$router = new Router(false);
$router
->removeExtraSlashes(true)
->mount(new \Backend\Modules\Site\Routes())
->mount(new \Backend\Modules\Admin\Routes())
->mount(new \Backend\Modules\API\Routes());
$router->notFound([
'module' => 'Site',
'controller' => 'Index',
'action' => 'Route404',
]);
return $router;
});
}
private function registerServices()
{
$di = $this->_di;
$di->set('redisConnection', function () {
$config = $this->get('config');
$Redis = new \Redis();
$Redis->connect($config->redis->connection->host);
return $Redis;
});
}
} |
#2 | Backend\App->getContent()
/var/www/hosting/ndb.by/backend/config/app.php (27) <?php
define('BASE_DIR', dirname(__DIR__));
ini_set('memory_limit', '-1');
//Временная зона
ini_set('date.timezone', 'Europe/Minsk');
if ( !defined('DEBUG') ) {
error_reporting(0);
ini_set('display_errors', '0');
}
/**
* Read loader
*/
include __DIR__ . '/loader.php';
/**
* Read services
*/
include __DIR__ . '/services.php';
$app = new \Backend\App($di);
echo $app->getContent(); |
#3 | include(/var/www/hosting/ndb.by/backend/config/app.php)
/var/www/hosting/ndb.by/backend/public/index.php (10) <?php
define('DEBUG', true);
error_reporting(E_ALL);
ini_set('display_errors', 1);
(new Phalcon\Debug())->listen();
include dirname(__DIR__) . '/config/app.php';
|