Passed
Push — master ( 0b7361...94c72e )
by Sebastien
15:37
created

run_process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 11
rs 10
1
<?php
2
3
if (! function_exists('packages_path')) {
4
    function packages_path($path = '')
5
    {
6
        $pathPrefix = rtrim(Storage::disk('packages')->getAdapter()->getPathPrefix(), DIRECTORY_SEPARATOR);
0 ignored issues
show
Bug introduced by
The method getAdapter() does not exist on Illuminate\Contracts\Filesystem\Filesystem. It seems like you code against a sub-type of Illuminate\Contracts\Filesystem\Filesystem such as Illuminate\Filesystem\FilesystemAdapter. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

6
        $pathPrefix = rtrim(Storage::disk('packages')->/** @scrutinizer ignore-call */ getAdapter()->getPathPrefix(), DIRECTORY_SEPARATOR);
Loading history...
7
8
        if (! empty($path)) {
9
            $pathPrefix .= DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR);
10
        }
11
12
        return rtrim($pathPrefix, DIRECTORY_SEPARATOR);
13
    }
14
}
15
16
if (! function_exists('run_process')) {
17
    function run_process(array $args = [])
18
    {
19
        $process = new Symfony\Component\Process\Process($args, base_path());
20
        $process->setTimeout(config('packager.timeout', 300));
21
        $process->run();
22
23
        if (! $process->isSuccessful()) {
24
            throw new Symfony\Component\Process\Exception\ProcessFailedException($process);
25
        }
26
27
        return $process->getExitCode() === 0;
28
    }
29
}
30