Completed
Branch master (48c558)
by
unknown
05:41
created

Template::_autorun()   A

Complexity

Conditions 3
Paths 1

Duplication

Lines 0
Ratio 0 %

Size

Total Lines 17
Code Lines 11

Code Coverage

Tests 11
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 11
cts 11
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 11
nc 1
nop 0
crap 3
1
<?php
2
namespace Redaxscript\Detector;
3
4
use Redaxscript\Db;
5
6
/**
7
 * children class to detect the required template
8
 *
9
 * @since 2.0.0
10
 *
11
 * @package Redaxscript
12
 * @category Detector
13
 * @author Henry Ruhs
14
 */
15
16
class Template extends DetectorAbstract
17
{
18
	/**
19
	 * automate run
20
	 *
21
	 * @since 2.1.0
22
	 */
23
24
	protected function _autorun()
25 2
	{
26
		$dbStatus = $this->_registry->get('dbStatus');
27 2
		$lastTable = $this->_registry->get('lastTable');
28 2
		$lastId = $this->_registry->get('lastId');
29 2
30 2
		/* detect template */
31 2
32
		$this->_detect(
33
		[
34
			'query' => $this->_request->getQuery('t'),
35 2
			'session' => $this->_request->getSession('template'),
36
			'contents' => $lastTable ? Db::forTablePrefix($lastTable)->whereIdIs($lastId)->findOne()->template : null,
37 2
			'settings' => $dbStatus === 2 ? Db::getSetting('template') : null,
38 2
			'fallback' => 'default'
39 2
		], 'template', 'templates/' . $this->_filePlaceholder . '/index.phtml');
40 2
	}
41
}
42