Passed
Push — 0.1.x ( 503b13...7dd316 )
by f
01:26
created

BasicFormat::createArchive()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
namespace wapmorgan\UnifiedArchive\Formats;
3
4
use wapmorgan\UnifiedArchive\ArchiveEntry;
5
use wapmorgan\UnifiedArchive\ArchiveInformation;
6
use wapmorgan\UnifiedArchive\UnsupportedOperationException;
7
8
abstract class BasicFormat
9
{
10
    /**
11
     * BasicFormat constructor.
12
     * @param string $archiveFileName
13
     */
14
    abstract public function __construct($archiveFileName);
15
16
    /**
17
     * Returns summary about an archive.
18
     * Called after
19
     * - constructing
20
     * - addFiles()
21
     * - deleteFiles()
22
     * @return ArchiveInformation
23
     */
24
    abstract public function getArchiveInformation();
25
26
    /**
27
     * @return array
28
     */
29
    abstract public function getFileNames();
30
31
    /**
32
     * @param string $fileName
33
     * @return bool
34
     */
35
    abstract public function isFileExists($fileName);
36
37
    /**
38
     * @param string $fileName
39
     * @return ArchiveEntry|false
40
     */
41
    abstract public function getFileData($fileName);
42
43
    /**
44
     * @param string $fileName
45
     * @return string|false
46
     */
47
    abstract public function getFileContent($fileName);
48
49
    /**
50
     * @param string $fileName
51
     * @return bool|resource|string
52
     */
53
    abstract public function getFileResource($fileName);
54
55
    /**
56
     * @param string $outputFolder
57
     * @param array  $files
58
     * @return false|int Number of extracted files
59
     */
60
    abstract public function extractFiles($outputFolder, array $files);
61
62
    /**
63
     * @param string $outputFolder
64
     * @return false|int Number of extracted files
65
     */
66
    abstract public function extractArchive($outputFolder);
67
68
    /**
69
     * @param array $files
70
     * @return false|int Number of deleted files
71
     */
72
    abstract public function deleteFiles(array $files);
73
74
    /**
75
     * @param array $files
76
     * @return false|int Number of added files
77
     */
78
    abstract public function addFiles(array $files);
79
80
    /**
81
     * @param array  $files
82
     * @param string $archiveFileName
83
     *
84
     * @return false|int Number of archived files
85
     * @throws UnsupportedOperationException
86
     */
87
    public static function createArchive(array $files, $archiveFileName) {
0 ignored issues
show
Unused Code introduced by
The parameter $files is not used and could be removed. ( Ignorable by Annotation )

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

87
    public static function createArchive(/** @scrutinizer ignore-unused */ array $files, $archiveFileName) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $archiveFileName is not used and could be removed. ( Ignorable by Annotation )

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

87
    public static function createArchive(array $files, /** @scrutinizer ignore-unused */ $archiveFileName) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
88
        throw new UnsupportedOperationException();
89
    }
90
}