Passed
Push — 0.1.x ( d58fb5...718fff )
by f
01:56
created

Archive7z   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 15
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getBinaryVersion() 0 9 2
1
<?php
2
namespace wapmorgan\UnifiedArchive\Formats;
3
4
use Symfony\Component\Process\Process;
5
6
class Archive7z extends \Archive7z\Archive7z
7
{
8
9
    /**
10
     * @throws \Archive7z\Exception
11
     */
12
    public static function getBinaryVersion()
13
    {
14
        $binary = static::makeBinary7z();
15
        $process = new Process(escapeshellarg(str_replace('\\', '/', $binary)));
0 ignored issues
show
Bug introduced by
escapeshellarg(str_replace('\', '/', $binary)) of type string is incompatible with the type array expected by parameter $command of Symfony\Component\Process\Process::__construct(). ( Ignorable by Annotation )

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

15
        $process = new Process(/** @scrutinizer ignore-type */ escapeshellarg(str_replace('\\', '/', $binary)));
Loading history...
16
        $result = $process->mustRun()->getOutput();
17
        if (!preg_match('~7-Zip (\d+\.\d+)~i', $result, $version))
18
            return false;
19
20
        return $version[1];
21
    }
22
}