Completed
Push — master ( 8e078a...edce3c )
by
unknown
15:28
created

ContentObjectArrayContentObject::render()   A

Complexity

Conditions 6
Paths 6

Size

Total Lines 19
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 12
nc 6
nop 1
dl 0
loc 19
rs 9.2222
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the TYPO3 CMS project.
5
 *
6
 * It is free software; you can redistribute it and/or modify it under
7
 * the terms of the GNU General Public License, either version 2
8
 * of the License, or any later version.
9
 *
10
 * For the full copyright and license information, please read the
11
 * LICENSE.txt file that was distributed with this source code.
12
 *
13
 * The TYPO3 project - inspiring people to share!
14
 */
15
16
namespace TYPO3\CMS\Frontend\ContentObject;
17
18
use TYPO3\CMS\Core\TimeTracker\TimeTracker;
19
use TYPO3\CMS\Core\Utility\GeneralUtility;
20
21
/**
22
 * Contains COA class object.
23
 */
24
class ContentObjectArrayContentObject extends AbstractContentObject
25
{
26
    /**
27
     * Rendering the cObject, COBJ_ARRAY / COA
28
     *
29
     * @param array $conf Array of TypoScript properties
30
     * @return string Output
31
     */
32
    public function render($conf = [])
33
    {
34
        if (empty($conf)) {
35
            $this->getTimeTracker()->setTSlogMessage('No elements in this content object array (COBJ_ARRAY, COA).', 2);
36
            return '';
37
        }
38
        if (!empty($conf['if.']) && !$this->cObj->checkIf($conf['if.'])) {
39
            return '';
40
        }
41
42
        $content = $this->cObj->cObjGet($conf);
43
        $wrap = $this->cObj->stdWrapValue('wrap', $conf);
44
        if ($wrap) {
45
            $content = $this->cObj->wrap($content, $wrap);
46
        }
47
        if (isset($conf['stdWrap.'])) {
48
            $content = $this->cObj->stdWrap($content, $conf['stdWrap.']);
49
        }
50
        return $content;
51
    }
52
53
    /**
54
     * @return TimeTracker
55
     */
56
    protected function getTimeTracker()
57
    {
58
        return GeneralUtility::makeInstance(TimeTracker::class);
59
    }
60
}
61