Passed
Push — master ( 3733ad...496203 )
by Aimeos
18:14 queued 04:23
created

Typo3::setCache()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
/**
4
 * @license LGPLv3, http://www.gnu.org/copyleft/lgpl.html
5
 * @copyright Aimeos (aimeos.org), 2015-2023
6
 * @package MAdmin
7
 * @subpackage Cache
8
 */
9
10
11
namespace Aimeos\MAdmin\Cache\Manager;
12
13
14
/**
15
 * Cache manager for the TYPO3 cache object.
16
 *
17
 * @package MAdmin
18
 * @subpackage Cache
19
 */
20
class Typo3 extends \Aimeos\MAdmin\Cache\Manager\Standard
21
{
22
	private \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache;
23
	private \Aimeos\Base\Cache\Iface $object;
24
25
26
	/**
27
	 * Sets the cache controller object.
28
	 *
29
	 * @param \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache TYPO3 cache object
30
	 * @return \Aimeos\MAdmin\Cache\Manager\Iface Same object for fluid interface
31
	 */
32
	public function setCache( \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache ) : Iface
33
	{
34
		$this->cache = $cache;
35
		return $this;
36
	}
37
38
39
	/**
40
	 * Returns the cache object or creates a new one if it doesn't exist yet.
41
	 *
42
	 * @return \Aimeos\Base\Cache\Iface Cache object
43
	 */
44
	public function getCache() : \Aimeos\Base\Cache\Iface
45
	{
46
		if( !isset( $this->object ) ) {
47
			$this->object = \Aimeos\Base\Cache\Factory::create( 'Typo3', $this->cache );
48
		}
49
50
		return $this->object;
51
	}
52
}
53