BashShell   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 23
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0
ccs 6
cts 6
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A exec() 0 12 1
1
<?php
2
3
namespace AsyncPHP\Doorman\Shell;
4
5
use AsyncPHP\Doorman\Shell;
6
7
final class BashShell implements Shell
8
{
9
    /**
10
     * @inheritdoc
11
     *
12
     * @param string $format
13
     * @param array $parameters
14
     *
15
     * @return array
16
     */
17 1
    public function exec($format, array $parameters = [])
18
    {
19 1
        $parameters = array_map("escapeshellarg", $parameters);
20
21 1
        array_unshift($parameters, $format);
22
23 1
        $command = call_user_func_array("sprintf", $parameters);
24
25 1
        exec($command, $output);
26
27 1
        return $output;
0 ignored issues
show
Bug Compatibility introduced by
The expression return $output; of type null|array is incompatible with the return type declared by the interface AsyncPHP\Doorman\Shell::exec of type string as it can also be of type array which is not included in this return type.
Loading history...
28
    }
29
}
30