Passed
Push — 0.1.x ( 6a5d6d...4972a0 )
by f
02:01
created

Archive7z   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 63.64%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 12
c 2
b 0
f 0
dl 0
loc 23
ccs 7
cts 11
cp 0.6364
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A getBinaryVersion() 0 17 3
1
<?php
2
namespace wapmorgan\UnifiedArchive\Formats;
3
4
use Symfony\Component\Process\Process;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Process\Process was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
5
6
class Archive7z extends \Archive7z\Archive7z
0 ignored issues
show
Bug introduced by
The type Archive7z\Archive7z was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
{
8
9
    /**
10
     * @throws \Archive7z\Exception
11
     */
12 1
    public static function getBinaryVersion()
13
    {
14 1
        if (method_exists(__CLASS__, 'makeBinary7z'))
15 1
            $binary = static::makeBinary7z();
16
        else {
17
            // some hack for gemorroj/archive7z 4.x version
18
            $seven_zip = new self(null);
19
            $binary = $seven_zip->getAutoCli();
20
            unset($seven_zip);
21
        }
22
23 1
        $process = new Process([str_replace('\\', '/', $binary)]);
24 1
        $result = $process->mustRun()->getOutput();
25 1
        if (!preg_match('~7-Zip (\[[\d]+\] )?(?<version>\d+\.\d+)~i', $result, $version))
26
            return false;
27
28 1
        return $version['version'];
29
    }
30
}