Code Duplication    Length = 30-30 lines in 2 locations

src/Extension/PhpSpecExtension/src/Process/CommandRunner/PassthruCommandRunner.php 1 location

@@ 7-36 (lines=30) @@
4
5
use RMiller\PhpSpecExtension\Process\CommandRunner;
6
7
class PassthruCommandRunner implements CommandRunner
8
{
9
    /**
10
     * @var CliFunctionChecker
11
     */
12
    private $functionChecker;
13
14
    /**
15
     * @param CliFunctionChecker $functionChecker
16
     */
17
    public function __construct(CliFunctionChecker $functionChecker) {
18
        $this->functionChecker = $functionChecker;
19
    }
20
21
    /**
22
     * @param $path
23
     * @param $args
24
     */
25
    public function runCommand($path, $args)
26
    {
27
        $command = escapeshellcmd($path) . ' ' . join(' ', array_map('escapeshellarg', $args));
28
        passthru($command, $exitCode);
29
        exit($exitCode);
30
    }
31
32
    public function isSupported()
33
    {
34
        return $this->functionChecker->functionCanBeUsed('passthru');
35
    }
36
}
37

src/Extension/PhpSpecRunExtension/src/Process/CommandRunner/PassthruCommandRunner.php 1 location

@@ 7-36 (lines=30) @@
4
5
use RMiller\PhpSpecRunExtension\Process\CommandRunner;
6
7
class PassthruCommandRunner implements CommandRunner
8
{
9
    /**
10
     * @var CliFunctionChecker
11
     */
12
    private $functionChecker;
13
14
    /**
15
     * @param CliFunctionChecker $functionChecker
16
     */
17
    public function __construct(CliFunctionChecker $functionChecker) {
18
        $this->functionChecker = $functionChecker;
19
    }
20
21
    /**
22
     * @param $path
23
     * @param $args
24
     */
25
    public function runCommand($path, $args)
26
    {
27
        $command = escapeshellcmd($path) . ' ' . join(' ', array_map('escapeshellarg', $args));
28
        passthru($command, $exitCode);
29
        exit($exitCode);
30
    }
31
32
    public function isSupported()
33
    {
34
        return $this->functionChecker->functionCanBeUsed('passthru');
35
    }
36
}
37