/var/www/Source/Framework/Component/Renderer.php:
12
namespace Clover\Framework\Component;
use Clover\Classes\File\Functions as FileFunction;
use Clover\Classes\Data\ArrayObject;
class Renderer
{
public function render(string $template, ArrayObject|array $data = []): string
{
$render = FileFunction::getInterpretedContent($template, $data);
return $render;
}
}
/var/www/Source/Framework/Component/BaseController.php:
136
{
/** @var Resource $resource */
$resource = $this->container->get('Resource');
$extractedRecources = $resource->extract();
/** @var Renderer $renderer */
$renderer = $this->container->get('Renderer');
$renderedContent = $renderer->render(__ROOT__ . $template, $data);
return $this->response($renderedContent, $extractedRecources);
}
}
/var/www/html/App/Controller/IndexController.php:
33
#[Annotation\Route(method: 'GET', pattern: '/product')]
public function product(Request $request)
{
$this->setTitle('Clover Framework');
$this->addCssFileToHead('https://fonts.googleapis.com/css?family=Titillium Web');
$this->addWebpackAssetsToHead('/App/Frontend/corejs/compiled/manifest.json');
return $this->render('/App/View/product.php', []);
}
#[Annotation\Route(method: 'GET', pattern: '/')]
public function index(Request $request)
{
/var/www/Source/Classes/Reflection/Handler.php:
852
$newInstance = $instance->newInstance($arguments);
if (!$instance->isInstance($newInstance)) {
return false;
}
$dependencies = [...$dependencies, ...array_filter(($passParameters instanceof ArrayObject) ? $passParameters->getRawData() : $passParameters)];
}
return $reflection->invoke($newInstance, ...$dependencies);
}
}
/var/www/Source/Classes/Routing/RequestHandler/StackableRequestHandler.php:
37
}
/**
* Call a top callback of last node
*/
public function handle()
{
$top = parent::$stock->top();
return $top();
}
}
/var/www/Source/Classes/Routing/Route.php:
240
* Handle a routes
*
* @return mixed
*/
public function handle(): mixed
{
$stackRequestHandler = new StackableRequestHandler();
$stackRequestHandler->pushItem($this->getExecutor());
$stackRequestHandler->addMiddlewares($this->middlewares, $this->container);
return $stackRequestHandler->handle();
}
public function isValidArgument($type, $value): bool
{
switch (strtoupper($type)) {
/var/www/Source/Classes/Routing/Router.php:
330
$route->setMiddlewares($this->middlewares);
}
/** Pass container when parent container is exists */
if (isset($this->container)) {
$route->setContainer($this->container);
}
/** Handle an routes */
return $route->handle();
}
/** Fire not found handler */
if ($this->notFoundHandler != null) {
$callback = $this->notFoundHandler;
/var/www/Source/Framework/Component/HttpKernel.php:
49
*/
public function run()
{
$router = new Router();
$router->fromDirectory(__ROOT__ . '/App/Controller');
$router->setContainer($this->container);
$response = $router->handle();
if (!$response) {
throw new \Exception("This request is not routing correctly");
}
/var/www/Source/Framework/Component/Runtime.php:
65
default:
flush();
}
}
private function setMapping(): void
{
$mapper = new Mapper($this->options, $this->environment);
$runner = $mapper->matchRunner();
$response = $runner->run();
if ($response instanceof Response) {
$response->printBody();
}
$this->flushResponseData();
/var/www/Source/Framework/Component/Runtime.php:
37
*/
public function run()
{
$this->setErrorHandler();
$this->setDefaultOptions();
$this->setEnvironmentVariables();
$this->applyOptions();
$this->setMapping();
}
public function setErrorHandler()
{
ErrorHandler::register();
/var/www/html/index.php:
14
if (!file_exists("./../vendor/autoload.php")) {
exit("Please run 'composer install' under application root directory");
}
include("./../vendor/autoload.php");
define('__ROOT__', __DIR__);
$runtime = new Runtime();
$runtime->run();