Passed
Push — master ( d8a10a...d39919 )
by Allan
02:25
created

SystemUtils   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 8
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCommandStdIn() 0 12 2
1
<?php
2
/**
3
 * Copyright © Vaimo Group. All rights reserved.
4
 * See LICENSE_VAIMO.txt for license details.
5
 */
6
namespace Vaimo\ComposerChangelogs\Utils;
7
8
class SystemUtils
9
{
10
    public function getCommandStdIn($command, $cwd, $default = '')
11
    {
12
        $process = new \Symfony\Component\Process\Process($command, $cwd);
13
14
        $process->setTimeout(null);
15
16
        try {
17
            $process->mustRun();
18
19
            return $process->getOutput();
20
        } catch (\Symfony\Component\Process\Exception\ProcessFailedException $exception) {
21
            return $default;
22
        }
23
    }
24
}
25