Issues (155)

src/Archive7z.php (3 issues)

1
<?php
2
namespace wapmorgan\UnifiedArchive;
3
4
use Symfony\Component\Process\Process;
0 ignored issues
show
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
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
     * @return false|string
10
     */
11 3
    public static function getBinaryVersion()
12
    {
13 3
        if (method_exists(__CLASS__, 'makeBinary7z'))
14
            try {
15 3
                $binary = static::makeBinary7z();
16
            } catch (\Exception $e) {
17 3
                return false;
18
            }
19
        else {
20
            // some hack for gemorroj/archive7z 4.x version
21
            try {
22
                $seven_zip = new self(null);
23
            } catch (\Exception $e) {
24
                return false;
25
            }
26
            $binary = $seven_zip->getAutoCli();
27
            unset($seven_zip);
28
        }
29
30 3
        $process = new Process([str_replace('\\', '/', $binary)]);
31 3
        $result = $process->mustRun()->getOutput();
32 3
        if (!preg_match('~7-Zip (\([a-z]\) )?(\[[\d]+\] )?(?<version>\d+\.\d+)~i', $result, $version))
33
            return false;
34
35 3
        return $version['version'];
36
    }
37
38
    /**
39
     * Hack to test if package is >=5.0.0.
40
     * setChangeSystemLocale() method was in 4.0.0 and then was removed.
41
     */
42 3
    public static function supportsAllFormats()
43
    {
44 3
        return !(method_exists(__CLASS__, 'setChangeSystemLocale'));
45
    }
46
47
    /**
48
     * @param int $level 0-9 level
49
     * @return $this
50
     */
51
    public function setCompressionLevel($level)
52
    {
53
        $this->compressionLevel = $level;
0 ignored issues
show
Bug Best Practice introduced by
The property compressionLevel does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
54
        return $this;
55
    }
56
}
57