#0 | App\Documentation\GithubSource->__construct
/srv/konekt.dev/web/releases/20250512132011/app/controllers/DocumentationController.php (95) <?php
/**
* Contains the DocumentationController class.
*
* @copyright Copyright (c) 2019 Attila Fulop
* @author Attila Fulop
* @license MIT
* @since 2019-06-08
*
*/
use App\Components\Component;
use App\Documentation\CachedSource;
use App\Documentation\Contracts\Documentation;
use App\Documentation\GithubSource;
use App\Documentation\LocalSource;
class DocumentationController extends BaseController
{
use ParsesMarkdown;
/** @var Component|null */
private $component;
/** @var Documentation */
private $documentation;
public function initialize()
{
parent::initialize();
$this->initializeMarkdown();
}
public function latestAction(string $component)
{
$this->loadComponent($component);
$version = $this->getDocumentation()->getLatestVersion();
$this->response->redirect([
'for' => 'documentation.show',
'version' => $version,
'component' => $component,
'page' => $this->getDocumentation()->indexForVersion($version),
]);
}
public function indexAction(string $component, string $version)
{
$this->loadComponent($component);
$this->response->redirect([
'for' => 'documentation.show',
'version' => $version,
'component' => $component,
'page' => $this->getDocumentation()->indexForVersion($version),
]);
}
public function showAction(string $component, string $version, string $page)
{
$this->loadComponent($component);
$doc = $this->getDocumentation();
if ($version === 'current') {
$version = $doc->getLatestVersion();
}
$content = $doc->getPage($page, $version);
if (!$content) {
return do404($this);
}
$title = $this->getPageTitle($content, $page);
$toc = $this->getDocumentation()->getPage('_sidebar', $version);
$this->view->pick('documentation/show');
$this->view->setVars([
'version' => $version,
'versions' => $doc->getVersions(),
'page' => $page,
'currentComponent' => $this->component,
'title' => $title,
'content' => $this->markdownToHtml($content, $version),
'toc' => $this->markdownToHtml($toc, $version)
]);
}
private function getDocumentation(): Documentation
{
if (!$this->documentation) {
$config = $this->di->get('config');
$this->documentation = match($config->get('source')) {
'local' => new LocalSource($this->component, $config),
default => new CachedSource(new GithubSource($this->component), $config),
};
}
return $this->documentation;
}
private function loadComponent(string $component)
{
$this->component = $this->componentRepository->findBySlug($component);
if (!$component) {
do404($this);
}
}
private function getPageTitle($md, $fallback)
{
$match = [];
if (preg_match('/^# ([\w ,\'"\.\?!\/\\\\`]+)\n/', $md, $match)) {
return $match[1];
}
return $fallback;
}
}
|
#1 | DocumentationController->getDocumentation
/srv/konekt.dev/web/releases/20250512132011/app/controllers/DocumentationController.php (62) <?php
/**
* Contains the DocumentationController class.
*
* @copyright Copyright (c) 2019 Attila Fulop
* @author Attila Fulop
* @license MIT
* @since 2019-06-08
*
*/
use App\Components\Component;
use App\Documentation\CachedSource;
use App\Documentation\Contracts\Documentation;
use App\Documentation\GithubSource;
use App\Documentation\LocalSource;
class DocumentationController extends BaseController
{
use ParsesMarkdown;
/** @var Component|null */
private $component;
/** @var Documentation */
private $documentation;
public function initialize()
{
parent::initialize();
$this->initializeMarkdown();
}
public function latestAction(string $component)
{
$this->loadComponent($component);
$version = $this->getDocumentation()->getLatestVersion();
$this->response->redirect([
'for' => 'documentation.show',
'version' => $version,
'component' => $component,
'page' => $this->getDocumentation()->indexForVersion($version),
]);
}
public function indexAction(string $component, string $version)
{
$this->loadComponent($component);
$this->response->redirect([
'for' => 'documentation.show',
'version' => $version,
'component' => $component,
'page' => $this->getDocumentation()->indexForVersion($version),
]);
}
public function showAction(string $component, string $version, string $page)
{
$this->loadComponent($component);
$doc = $this->getDocumentation();
if ($version === 'current') {
$version = $doc->getLatestVersion();
}
$content = $doc->getPage($page, $version);
if (!$content) {
return do404($this);
}
$title = $this->getPageTitle($content, $page);
$toc = $this->getDocumentation()->getPage('_sidebar', $version);
$this->view->pick('documentation/show');
$this->view->setVars([
'version' => $version,
'versions' => $doc->getVersions(),
'page' => $page,
'currentComponent' => $this->component,
'title' => $title,
'content' => $this->markdownToHtml($content, $version),
'toc' => $this->markdownToHtml($toc, $version)
]);
}
private function getDocumentation(): Documentation
{
if (!$this->documentation) {
$config = $this->di->get('config');
$this->documentation = match($config->get('source')) {
'local' => new LocalSource($this->component, $config),
default => new CachedSource(new GithubSource($this->component), $config),
};
}
return $this->documentation;
}
private function loadComponent(string $component)
{
$this->component = $this->componentRepository->findBySlug($component);
if (!$component) {
do404($this);
}
}
private function getPageTitle($md, $fallback)
{
$match = [];
if (preg_match('/^# ([\w ,\'"\.\?!\/\\\\`]+)\n/', $md, $match)) {
return $match[1];
}
return $fallback;
}
}
|
#5 | Phalcon\Mvc\Application->handle
/srv/konekt.dev/web/releases/20250512132011/public/index.php (21) <?php
define('BASE_PATH', dirname(__DIR__));
define('APP_PATH', BASE_PATH . '/app');
define('VAR_PATH', BASE_PATH . '/var');
define('PUBLIC_PATH', BASE_PATH . '/public');
if (true || 'dev' == getenv('APP_ENV')) {
ini_set('display_errors', 1);
$debug = new \Phalcon\Support\Debug();
$debug->listen();
}
require_once BASE_PATH . '/vendor/autoload.php';
$application = require_once(APP_PATH . '/boot.php');
try {
$request = new Phalcon\Http\Request();
$response = $application->handle($request->getURI());
$response->send();
} catch (\Exception $e) {
$errorHtml = file_get_contents(dirname(__DIR__) . '/app/views/error/500.html');
echo str_replace('{{ error_message }}', $e->getMessage(), $errorHtml);
}
|