Passed
Push — master ( 9b7194...5e0483 )
by
unknown
17:21
created

TcaDisplayConditions::isIPLockEnabled()   A

Complexity

Conditions 5
Paths 5

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 6
nc 5
nop 1
dl 0
loc 10
rs 9.6111
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the TYPO3 CMS project.
7
 *
8
 * It is free software; you can redistribute it and/or modify it under
9
 * the terms of the GNU General Public License, either version 2
10
 * of the License, or any later version.
11
 *
12
 * For the full copyright and license information, please read the
13
 * LICENSE.txt file that was distributed with this source code.
14
 *
15
 * The TYPO3 project - inspiring people to share!
16
 */
17
18
namespace TYPO3\CMS\Core\Hooks;
19
20
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
21
22
/**
23
 * Various display conditions to check for e.g. installed extensions or configuration settings used.
24
 *
25
 * @internal This class is a hook implementation and is not part of the TYPO3 Core API.
26
 */
27
class TcaDisplayConditions
28
{
29
    /**
30
     * Check if an extension is loaded.
31
     *
32
     * @param array $parameters
33
     * @return bool
34
     */
35
    public function isExtensionInstalled(array $parameters): bool
36
    {
37
        $extension = $parameters['conditionParameters'][0] ?? '';
38
        if (!empty($extension)) {
39
            return ExtensionManagementUtility::isLoaded($extension);
40
        }
41
        return false;
42
    }
43
}
44