Completed
Push — master ( 40853b...0d769e )
by Carlos C
02:53
created

ShellWhich   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpCfdi\RfcLinc\Util;
6
7
class ShellWhich
8
{
9 4
    public function __invoke(string $executable): string
10
    {
11 4
        $lines = [];
12 4
        $return = -1;
13 4
        $output = (string) exec('which ' . escapeshellarg($executable), $lines, $return);
14 4
        if (0 !== (int) $return) {
15 1
            return '';
16
        }
17 3
        return $output;
18
    }
19
}
20