BashShell::exec()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
c 0
b 0
f 0
rs 9.8666
cc 1
nc 1
nop 2
1
<?php
2
3
namespace AsyncPHP\Doorman\Shell;
4
5
use AsyncPHP\Doorman\Shell;
6
7
class BashShell implements Shell
8
{
9
    /**
10
     * @inheritdoc
11
     *
12
     * @param string $format
13
     * @param array  $parameters
14
     *
15
     * @return array
16
     */
17
    public function exec($format, array $parameters = array())
18
    {
19
        $parameters = array_map("escapeshellarg", $parameters);
20
21
        array_unshift($parameters, $format);
22
23
        $command = call_user_func_array("sprintf", $parameters);
24
25
        exec($command, $output);
26
27
        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