Completed
Push — issue/444 ( 7ee4c4 )
by Tomas Norre
06:40
created

PhpBinaryUtility   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getPhpBinary() 0 14 3
1
<?php
2
declare(strict_types=1);
3
namespace AOE\Crawler\Utility;
4
5
/*
6
 * (c) 2019 AOE GmbH <[email protected]>
7
 *
8
 * This file is part of the TYPO3 Crawler Extension.
9
 *
10
 * It is free software; you can redistribute it and/or modify it under
11
 * the terms of the GNU General Public License, either version 2
12
 * of the License, or any later version.
13
 *
14
 * For the full copyright and license information, please read the
15
 * LICENSE.txt file that was distributed with this source code.
16
 *
17
 * The TYPO3 project - inspiring people to share!
18
 */
19
20
use TYPO3\CMS\Core\Utility\CommandUtility;
21
22
class PhpBinaryUtility
23
{
24
    /**
25
     * @param array $extensionSettings
26
     * @return string
27
     */
28
    public static function getPhpBinary(array $extensionSettings): string
29
    {
30
        if (empty($extensionSettings)) {
31
            throwException('ExtensionSettings are empty');
32
        }
33
34
        if (empty($extensionSettings['phpPath'])) {
35
            $phpPath = CommandUtility::getCommand($extensionSettings['phpBinary']);
36
        } else {
37
            $phpPath = $extensionSettings['phpPath'];
38
        }
39
40
        return $phpPath;
41
    }
42
}
43