/home/i/ikolbin/sila-shop.ru/vendor/phact-cmf/phact/src/Phact/Application/Application.php
public function handleWebRequest()
{
/** @var HttpRequestInterface $request */
$request = $this->getComponent(HttpRequestInterface::class);
/** @var RouterInterface $router */
$router = $this->getComponent(RouterInterface::class);
$url = $request->getUrl();
$method = $request->getMethod();
$this->logDebug("Matching route for url '{$url}' and method '{$method}'");
$matches = $router->match($url, $method);
foreach ($matches as $match) {
$matched = $this->handleMatch($match, $router);
if ($matched !== false) {
return true;
}
}
$this->logDebug("Matching route not found");
throw new NotFoundHttpException("Page not found");
}
public function handleMatch(array $match, RouterInterface $router = null)
{
if (is_array($match['target']) &&
isset($match['target'][0]) &&
is_a($match['target'][0], ControllerInterface::class, true))
{
$controllerClass = $match['target'][0];
$action = isset($match['target'][1]) ? $match['target'][1] : null;
$params = isset($match['params']) ? $match['params'] : [];
$name = isset($match['name']) ? $match['name'] : null;
if ($router && $name) {
$router->setCurrentName($name);
}
$this->logDebug("Processing route to controller '{$controllerClass}' and action '{$action}'", ['params' => $params]);
/** @var Controller $controller */
$controller = $this->_container->construct($controllerClass);
/home/i/ikolbin/sila-shop.ru/vendor/phact-cmf/phact/src/Phact/Application/Application.php
$this->logDebug("Application run");
$this->eventTrigger("application.beforeRun", [], $this);
$this->provideModuleEvent('onApplicationRun');
register_shutdown_function([$this, 'end'], 0);
$this->logDebug("Start handling request");
$this->handleRequest();
$this->end();
}
public function end($status = 0, $response = null)
{
$this->eventTrigger("application.beforeEnd", [], $this);
$this->provideModuleEvent('onApplicationEnd', [$status, $response]);
exit($status);
}
public function handleRequest()
{
if ($this->getIsWebMode()) {
$this->handleWebRequest();
} else {
$this->handleCliRequest();
}
}
/**
* @return bool
*/
public static function getIsCliMode()
{
return php_sapi_name() == 'cli';
}
/**
* @return bool
*/
public static function getIsWebMode()
{
return !self::getIsCliMode();
}
/home/i/ikolbin/sila-shop.ru/vendor/phact-cmf/phact/src/Phact/Application/Application.php
/**
* Check or create system path
*
* @param $path
* @return bool
*/
protected function setUpPath($path): bool
{
return is_dir($path) || mkdir($path, 0755, true);
}
public function run()
{
$this->logDebug("Application run");
$this->eventTrigger("application.beforeRun", [], $this);
$this->provideModuleEvent('onApplicationRun');
register_shutdown_function([$this, 'end'], 0);
$this->logDebug("Start handling request");
$this->handleRequest();
$this->end();
}
public function end($status = 0, $response = null)
{
$this->eventTrigger("application.beforeEnd", [], $this);
$this->provideModuleEvent('onApplicationEnd', [$status, $response]);
exit($status);
}
public function handleRequest()
{
if ($this->getIsWebMode()) {
$this->handleWebRequest();
} else {
$this->handleCliRequest();
}
}
/**
/home/i/ikolbin/sila-shop.ru/www/index.php
<?php
include(__DIR__ . '/../vendor/autoload.php');
$dotenv = Dotenv\Dotenv::create(__DIR__ . '/../');
$dotenv->load();
define('PHACT_DEBUG', getenv('DEBUG') === 'true');
$config = include __DIR__ . '/../app/config/settings.php';
\Phact\Main\Phact::init($config);
\Phact\Main\Phact::app()->run();