Get Page Trace

@return array
437654
protected function getTrace()
    {
        $files = get_included_files();
        $config = Container::get('config')->getArray();
        $server = $_SERVER;
        $cookie = $_COOKIE;
        $info = [];
        foreach ($files as $key => $file) {
            $info[] = $file . ' ( ' . number_format(filesize($file) / 1024, 2) . ' KB )';
        }

        $hook = Hook::getTags();
        foreach ($hook as $key => $value) {
            $hook[$key] = ' ( ' . $value . ' μs )';
        }

        $error = Handle::$errors;

        $sql = Database::$queries;

        $base = [
            'Request Info' => date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . ' ' . $_SERVER['SERVER_PROTOCOL'] . ' ' . $_SERVER['REQUEST_METHOD'] . ' : ' . $_SERVER['PHP_SELF'],
            'Run Time' => Hook::listen(\Kotori\App::class) . 'μs',
            'TPR' => Hook::listen(\Kotori\App::class) != 0 ? pow(10, 6) / Hook::listen(\Kotori\App::class) . ' req/s' : '+inf',
            'Memory Uses' => number_format((memory_get_usage() - KOTORI_START_MEMORY) / 1024, 2) . ' kb',
            'SQL Queries' => count($sql) . ' queries ',
            'File Loaded' => count(get_included_files()),
            'Session Info' => 'SESSION_ID=' . session_id(),
        ];

        $support = [
            '<a target="_blank" href="https://github.com/kokororin/Kotori.php">GitHub</a>',
            '<a target="_blank" href="https://kotori.love/archives/kotori-php-framework.html">Blog</a>',
        ];

        $trace = [];
        foreach ($this->traceTabs as $name => $title) {
            switch (strtoupper($name)) {
                case 'BASE':
                    $trace[$title] = $base;
                    break;
                case 'CONFIG':
                    $trace[$title] = $config;
                    break;
                case 'SERVER':
                    $trace[$title] = $server;
                    break;
                case 'COOKIE':
                    $trace[$title] = $cookie;
                    break;
                case 'FILE':
                    $trace[$title] = $info;
                    break;
                case 'FLOW':
                    $trace[$title] = $hook;
                    break;
                case 'ERROR':
                    $trace[$title] = $error;
                    break;
                case 'SQL':
                    $trace[$title] = $sql;
                    break;
                case 'SUPPORT':
                    $trace[$title] = $support;
                    break;
            }
        }

        return $trace;
    }
775586
public function info()
    {
        $data = [
            'traceId' => $this->traceId,
            'spanId' => $this->spanId,
            'type' => $this->type
        ];
        if ($this->attributes) {
            $data['attributes'] = $this->attributes->info();
        }

        return $data;
    }
351190
public function getPage()
	{
		return $this->offset > $this->limit ? floor($this->offset / $this->limit) : 1;
	}
927730
public function info()
    {
        $this->logger->debug('Page:info');
        if (!$this->setIdentifier('', 's')) {
            return [];
        }
        $this->setParam('prop', 'pageprops');
        $this->send();
        return Tools::flatten($this->getResponse(['query', 'pages']));
    }
572197
private function getCmsRoutes(): array
    {
        if ($this->routes) {
            return $this->routes;
        }

        $item = $this->cache->getItem(self::PAGES_ROUTES_CACHE_KEY);

        if ($item->isHit()) {
            return $this->routes = $item->get();
        }

        $routes = $this->repository->getPagesRoutes();

        $item->set($routes);
        $this->cache->save($item);

        return $this->routes = $routes;
    }
623269
public function getTotalPages()
    {
        // Pages before
        $pages = ceil(($this->getFirstShown() - 1) / $this->getItemsPerPage());

        // Current page
        $pages++;

        // Pages after
        $pages += ceil(($this->getTotalRecords() - $this->getLastShown()) / $this->getItemsPerPage());

        return (int) $pages;
    }
595278
private function getPages()
    {
        $rootPageId = $this->pluginConfig['urlEntries']['pages']['rootPageId'];
        $rootPage = $this->pageRepository->getPage($rootPageId);

        $cacheIdentifier = md5($rootPageId . '-pagesForSitemap');
        if ($this->cacheInstance->has($cacheIdentifier)) {
            $pages = $this->cacheInstance->get($cacheIdentifier);
        } else {
            $pages = $this->getSubPagesRecursive($rootPageId);
            $this->cacheInstance->set($cacheIdentifier, $pages, ['pagesForSitemap']);
        }

        return array_merge([$rootPage], $pages);
    }
1145473
public function getPages()
    {
        $pages = array();

        foreach ($this->router->getRouteCollection()->all() as $route) {
            if ($method = $this->getReflectionMethod($route->getDefault('_controller'))) {
                if ($composerAnnotation = $this->reader->getMethodAnnotation($method, self::COMPOSER_ANNOTATION_CLASS)) {
                    if ($composerAnnotation !== null) {
                        // setup a fresh page object
                        $page = new Page();
                        $page->setName($composerAnnotation->getName());

                        // create url from route annotation or from route pattern
                        $routeAnnotation = $this->reader->getMethodAnnotation($method, self::ROUTE_ANNOTATION_CLASS);

                        try {
                            $page->setUrl($this->router->generate($routeAnnotation->getName()));
                        }
                        catch (RouteNotFoundException $e) {
                            $this->container->get('logger')->info('The @Route annotation of '.$route->getDefault('_controller').' has no name. Please specify it for better page linking.');
                            $page->setUrl($this->router->getContext()->getBaseUrl().$route->getPattern());
                        }

                        // add page
                        $pages[] = $page;
                    }
                }
            }
        }

        return $pages;
    }
860309
protected function _getLocation($traces)
    {
        for ($i = count($traces) - 1; $i >= 0; $i--) {
            $trace = $traces[$i];
            if ($trace['function'] === '__call' || in_array($trace['function'], self::$_levels, true)) {
                return $trace;
            }
        }

        return [];
    }
64875
protected function getPageLogin()
    {
        $this->debug('Controller and action changed to: ' . implode("/", $this->pageLogin));
        if (isset($this->pageLogin[3]))
            $this->request()->setModule($this->pageLogin[3]);
        if (isset($this->pageLogin[2]) && is_string($this->pageLogin[2]))
            $this->request()->setModule($this->pageLogin[2]);
        elseif (isset($this->pageLogin[2]) && is_array($this->pageLogin[2]) && !empty($this->pageLogin[2]))
            $this->request()->setParams($this->pageLogin[2]);
        $this->request()->setController($this->pageLogin[0]);
        $this->request()->setAction($this->pageLogin[1]);
        return $this->getControllerClassFromNameAndModule($this->pageLogin[0], $this->request()->getModule());
    }
639226
protected function getPrevious() {
		if ($this->get('page')> 1) {
			return $this->replaceLine($this->get('page') - 1, $this->get('previous'));
		}
		return null;
	}
992435
public function humaniceTrace(array $trace) {
        /* @var $html_helper HtmlHelper */
        $html_helper = $this->html;
        $list = [];
        foreach ($trace as $id_trace => $e) {
            $class = explode('\\', key_exists('class', $e) ? $e['class'] : '');
            $type = key_exists('type', $e) ? $e['type'] : '';
            $function = key_exists('function', $e) ? $e['function'] : '';
            $args = key_exists('args', $e) ? $e['args'] : [];
            $file = key_exists('file', $e) ? $e['file'] : [];
            $line = key_exists('line', $e) ? $e['line'] : [];

            $item = $class ? '<span style="color:blue" title="' . implode('\\', $class) . '">' . end($class) . '</span>' : '';
            $item .= $type ? '<span style="color:teal">' . $type . '</span>' : '';
            $item .= $function ? '<span style="color:red">' . $function . '</span>' : '';
            $item .= $args ? 
                    '(' .
                        $html_helper->link(count($args) . ' arg', [], 
                            ['onclick' => 'var a=document.getElementById(\'args_' . $id_trace . '\');'
                                . ' if (a.style.display==\'block\') { a.style.display=\'none\' } else { a.style.display=\'block\' };'
                                . 'return false;']) . 
                    ')' : '()';
            $item .= $file ? ' - <span style="color:lightgray" onmouseover="this.style.color=\'gray\'" '
                    . 'onmouseout="this.style.color=\'lightgray\'" >' . $file . '</span>' : '';
            $item .= $line ? ' <span style="color:salmon">' . $line . '</span>' : '';
            $item .= $args ? '<div style="display:none" id="args_' . $id_trace . '">' . @d($args) . '</div>' : '';
            
            $list[] = $item;
        }
        
        return $html_helper->nestedList($list, [
                'style' => 'font-family: arial; line-height:30px;',
                'reversed' => 'reversed'
            ], [], 'ordered');
    }
401028
protected function getCurrentPageAncestry()
    {
        $tools = ViewTools::singleton();
        
        if (($page = Director::get_current_page()) && $page instanceof Page) {
            return $tools->array2att($tools->getAncestorClassNames($page, Page::class));
        }
    }
815820
public function getCurrentPageAncestry()
    {
        $ancestry = ViewTools::singleton()->convertClass(
            ClassTools::singleton()->getObjectAncestry($this->getCurrentPageClass(), Page::class, true)
        );
        
        return ViewTools::singleton()->array2att($ancestry);
    }
820212
private function getViewsToTreat()
    {
        $templateRepo = $this->entityManager->getRepository('VictoireTemplateBundle:Template');
        $rootTemplates = $templateRepo->getInstance()
            ->where('template.template IS NULL')
            ->getQuery()
            ->getResult();
        $templates = [];
        $recursiveGetTemplates = function ($template) use (&$recursiveGetTemplates, &$templates) {
            array_push($templates, $template);
            foreach ($template->getInheritors() as $_template) {
                if ($_template instanceof Template) {
                    $recursiveGetTemplates($_template);
                }
            }
        };

        foreach ($rootTemplates as $rootTemplate) {
            $recursiveGetTemplates($rootTemplate);
        }

        $pageRepo = $this->entityManager->getRepository('VictoirePageBundle:BasePage');
        $pages = $pageRepo->findAll();
        $errorRepo = $this->entityManager->getRepository('VictoireTwigBundle:ErrorPage');
        $errorPages = $errorRepo->findAll();

        return array_merge($templates, array_merge($pages, $errorPages));
    }
165034
public function get()
    {
        $trackings = [];
        if (Session::has($this->sessionIdentifier)) {
            $trackings = Session::get($this->sessionIdentifier);
            Session::forget($this->sessionIdentifier);
        }

        return $trackings;
    }
153706
public function current()
    {
        if ($this->page === null) {
            $this->page = $this->executeCall();
        }

        $page = $this->get($this->itemsPath, $this->page);

        if ($this->nextResultToken()) {
            return $page ?: [];
        }

        return $page;
    }