Completed
Push — master ( 98c693...303c9f )
by Aimeos
02:54
created

Typo3   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 35
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A render() 0 9 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2017
6
 * @package MW
7
 * @subpackage View
8
 */
9
10
11
namespace Aimeos\MW\View\Engine;
12
13
14
/**
15
 * TYPO3 view engine implementation
16
 *
17
 * @package MW
18
 * @subpackage View
19
 */
20
class Typo3 implements Iface
21
{
22
	private $objectManager;
23
24
25
	/**
26
	 * Initializes the view object
27
	 *
28
	 * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager TYPO3 object manager
29
	 */
30
	public function __construct( \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager )
31
	{
32
		$this->objectManager = $objectManager;
33
	}
34
35
36
	/**
37
	 * Renders the output based on the given template file name and the key/value pairs
38
	 *
39
	 * @param \Aimeos\MW\View\Iface $view View object
40
	 * @param string $filename File name of the view template
41
	 * @param array $values Associative list of key/value pairs
42
	 * @return string Output generated by the template
43
	 * @throws \Aimeos\MW\View\Exception If the template isn't found
44
	 */
45
	public function render( \Aimeos\MW\View\Iface $view, $filename, array $values )
46
	{
47
		$fluid = $this->objectManager->get( 'TYPO3\\CMS\\Fluid\\View\\StandaloneView' );
48
49
		$fluid->setTemplatePathAndFilename( $filename );
50
		$fluid->assignMultiple( $values );
51
52
		return $fluid->render();
53
	}
54
}
55