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

PhpBinaryUtility::getPhpBinary()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
nc 4
nop 1
dl 0
loc 14
ccs 0
cts 12
cp 0
crap 12
rs 9.7998
c 0
b 0
f 0
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