/var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/debug_kit/src/Controller
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/debug_kit/src/Controller/PanelsController.php (3489B)
loadComponent('RequestHandler');
}
/**
* Before render handler.
*
* @param \Cake\Event\EventInterface $event The event.
* @return void
*/
public function beforeRender(EventInterface $event)
{
$this->viewBuilder()
->addHelpers([
'Form', 'Html', 'Number', 'Url', 'DebugKit.Toolbar',
'DebugKit.Credentials', 'DebugKit.SimpleGraph',
])
->setLayout('DebugKit.toolbar');
if (!$this->request->is('json')) {
$this->viewBuilder()->setClassName('DebugKit.Ajax');
}
}
/**
* Index method that lets you get requests by panelid.
*
* @param string $requestId Request id
* @return void
* @throws \Cake\Http\Exception\NotFoundException
*/
public function index($requestId = null)
{
$query = $this->Panels->find('byRequest', ['requestId' => $requestId]);
$panels = $query->toArray();
if (empty($panels)) {
throw new NotFoundException();
}
$this->set([
'panels' => $panels,
]);
$this->viewBuilder()->setOption('serialize', ['panels']);
}
/**
* View a panel's data.
*
* @param string $id The id.
* @return void
*/
public function view($id = null)
{
$this->set('sort', $this->request->getCookie('debugKit_sort'));
$panel = $this->Panels->get($id, ['contain' => ['Requests']]);
$this->set('panel', $panel);
// @codingStandardsIgnoreStart
$this->set(@unserialize($panel->content));
// @codingStandardsIgnoreEnd
}
/**
* Get Latest request history panel
*
* @return \Cake\Http\Response|null
*/
public function latestHistory()
{
/** @var array{id:string}|null $request */
$request = $this->Panels->Requests->find('recent')
->select(['id'])
->disableHydration()
->first();
if (!$request) {
throw new NotFoundException('No requests found');
}
/** @var array{id:string}|null $historyPanel */
$historyPanel = $this->Panels->find('byRequest', ['requestId' => $request['id']])
->where(['title' => 'History'])
->select(['id'])
->first();
if (!$historyPanel) {
throw new NotFoundException('History Panel from latest request not found');
}
return $this->redirect([
'action' => 'view', $historyPanel['id'],
]);
}
}