Issues (138)

Classes/Utility/HookUtility.php (2 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace AOE\Crawler\Utility;
6
7
/*
8
 * (c) 2020 AOE GmbH <[email protected]>
9
 *
10
 * This file is part of the TYPO3 Crawler Extension.
11
 *
12
 * It is free software; you can redistribute it and/or modify it under
13
 * the terms of the GNU General Public License, either version 2
14
 * of the License, or any later version.
15
 *
16
 * For the full copyright and license information, please read the
17
 * LICENSE.txt file that was distributed with this source code.
18
 *
19
 * The TYPO3 project - inspiring people to share!
20
 */
21
22
use AOE\Crawler\Hooks\ProcessCleanUpHook;
23
24
/**
25
 * @codeCoverageIgnore
26
 * @internal since v9.2.5
27
 */
28
class HookUtility
29
{
30
    /**
31
     * Registers hooks
32
     *
33
     * @param string $extKey
34
     */
35
    public static function registerHooks($extKey): void
36
    {
37
        // Activating Crawler cli_hooks
38
        $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey]['cli_hooks'][] =
39
            ProcessCleanUpHook::class;
40
41
        // Activating refresh hooks
42
        $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey]['refresh_hooks'][] =
43
            ProcessCleanUpHook::class;
44
45
        // Env-dependent
46
        if (TYPO3_MODE === 'BE') {
0 ignored issues
show
The condition AOE\Crawler\Utility\TYPO3_MODE === 'BE' is always true.
Loading history...
47
            self::registerBackendHooks($extKey);
48
        }
49
    }
50
51
    /**
52
     * @noRector \Rector\DeadCode\Rector\ClassMethod\RemoveUnusedParameterRector
53
     */
54
    private static function registerBackendHooks(string $extKey): void
0 ignored issues
show
The parameter $extKey is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

54
    private static function registerBackendHooks(/** @scrutinizer ignore-unused */ string $extKey): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
55
    {
56
        // DataHandler clear page cache pre-processing
57
        $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearPageCacheEval'][] =
58
            "AOE\Crawler\Hooks\DataHandlerHook->addFlushedPagesToCrawlerQueue";
59
    }
60
}
61