SystemUtils   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 9
c 2
b 0
f 0
dl 0
loc 13
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCommandStdOut() 0 11 3
1
<?php
2
/**
3
 * Copyright © Vaimo Group. All rights reserved.
4
 * See LICENSE_VAIMO.txt for license details.
5
 */
6
7
namespace Vaimo\ComposerChangelogs\Utils;
8
9
class SystemUtils
10
{
11
    public function getCommandStdOut($command, $cwd, $default = '')
12
    {
13
        $command = \is_array($command) ? $command : \explode(' ', $command);
14
        $process = new \Symfony\Component\Process\Process($command, $cwd);
15
        $process->setTimeout(null);
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