Completed
Push — master ( 9027b3...432a29 )
by Henry
12:53 queued 02:53
created

includes/Detector/Template.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
namespace Redaxscript\Detector;
3
4
use Redaxscript\Filter;
5
use Redaxscript\Model;
6
7
/**
8
 * children class to detect the current template
9
 *
10
 * @since 2.0.0
11
 *
12
 * @package Redaxscript
13
 * @category Detector
14
 * @author Henry Ruhs
15
 */
16
17
class Template extends DetectorAbstract
18
{
19
	/**
20
	 * automate run
21
	 *
22
	 * @since 2.1.0
23
	 */
24
25 7
	public function autorun() : void
26
	{
27 7
		$settingModel = new Model\Setting();
28 7
		$contentModel = new Model\Content();
29 7
		$specialFilter = new Filter\Special();
30 7
		$dbStatus = $this->_registry->get('dbStatus');
31 7
		$lastTable = $this->_registry->get('lastTable');
32 7
		$lastId = $this->_registry->get('lastId');
33 7
		$path = 'templates' . DIRECTORY_SEPARATOR . $this->_filePlaceholder . DIRECTORY_SEPARATOR . 'index.phtml';
34
		$setupArray =
35
		[
36 7
			'query' => $specialFilter->sanitize($this->_request->getQuery('t')),
37 7
			'session' => $this->_request->getSession('template'),
38 7
			'contents' => $contentModel->getByTableAndId($lastTable, $lastId)?->template,
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_OBJECT_OPERATOR
Loading history...
39 7
			'settings' => $dbStatus === 2 ? $settingModel->get('template') : null,
40 7
			'fallback' => 'default'
41
		];
42
43
		/* detect template */
44
45 7
		$this->_output = $this->_detect('template', $path, $setupArray);
46 7
	}
47
}
48