ContentPostProcAll::process()   A
last analyzed

Complexity

Conditions 6
Paths 10

Size

Total Lines 19
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 42

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 6
eloc 12
nc 10
nop 2
dl 0
loc 19
ccs 0
cts 17
cp 0
crap 42
rs 9.2222
c 1
b 0
f 0
1
<?php
2
namespace Aoe\Asdis\Typo3\Hook;
3
4
use Aoe\Asdis\Typo3\Hook\AbstractHook;
5
6
class ContentPostProcAll extends AbstractHook
7
{
8
    /**
9
     * @param array $params
10
     * @param \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $pObj
11
     * @return void
12
     */
13
    public function process(&$params, \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $pObj = null)
14
    {
15
        if ($this->getConfigurationProvider()->isDefaultHookHandlingDisabled()) {
16
            return;
17
        }
18
        
19
        if (null === $pObj) {
20
            if (isset($params['pObj']) && ($params['pObj'] instanceof \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController)) {
21
                $pObj = $params['pObj'];
22
            } else {
23
                $pObj = $GLOBALS['TSFE'];
24
            }
25
        }
26
27
        try {
28
            $this->setPageObject($pObj);
29
            $this->scrapeAndReplace();
30
        } catch(\Exception $e) {
31
            $this->getLogger()->logException(__METHOD__, $e);
32
        }
33
    }
34
35
    /**
36
     * Call main process hook function only if there are no INTincScripts to include.
37
     * This function is called as contentPostProc-all hook.
38
     *
39
     * @param array $params
40
     * @param \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $pObj
41
     * @return void
42
     */
43
    public function processCache(&$params, \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $pObj = null)
44
    {
45
        if ($GLOBALS['TSFE']->isINTincScript()) {
46
            return;
47
        }
48
        $this->process($params, $pObj);
49
    }
50
51
    /**
52
     * Call main process hook function only if there are INTincScripts to include.
53
     * This function is called as contentPostProc-output hook.
54
     * @param array $params
55
     * @param \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $pObj
56
     * @return void
57
     */
58
    public function processNoCache(&$params, \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $pObj = null)
59
    {
60
        if (!$GLOBALS['TSFE']->isINTincScript()) {
61
            return;
62
        }
63
        $this->process($params, $pObj);
64
    }
65
66
}