1
|
|
|
<?php namespace Comodojo\Zip\Traits; |
2
|
|
|
|
3
|
|
|
use \Comodojo\Zip\Interfaces\ZipInterface; |
4
|
|
|
use \Comodojo\Exception\ZipException; |
5
|
|
|
|
6
|
|
|
/** |
7
|
|
|
* Skip mode helper trait. |
8
|
|
|
* |
9
|
|
|
* @package Comodojo Zip |
10
|
|
|
* @author Marco Giovinazzi <[email protected]> |
11
|
|
|
* @license MIT |
12
|
|
|
* |
13
|
|
|
* LICENSE: |
14
|
|
|
* |
15
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
16
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
17
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
18
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
19
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
20
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
21
|
|
|
* THE SOFTWARE. |
22
|
|
|
*/ |
23
|
|
|
|
24
|
|
|
trait SkipTrait { |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Select files to skip |
28
|
|
|
* |
29
|
|
|
* @var string |
30
|
|
|
*/ |
31
|
|
|
private $skip_mode = 'NONE'; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Supported skip modes |
35
|
|
|
* |
36
|
|
|
* @var bool |
37
|
|
|
*/ |
38
|
|
|
private $supported_skip_modes = ['NONE', 'HIDDEN', 'ALL', 'COMODOJO']; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Set files to skip |
42
|
|
|
* |
43
|
|
|
* Supported skip modes: |
44
|
|
|
* Zip::SKIP_NONE - skip no files |
45
|
|
|
* Zip::SKIP_HIDDEN - skip hidden files |
46
|
|
|
* Zip::SKIP_ALL - skip HIDDEN + COMODOJO ghost files |
47
|
|
|
* Zip::SKIP_COMODOJO - skip comodojo ghost files |
48
|
|
|
* |
49
|
|
|
* @param string $mode Skip file mode |
50
|
|
|
* |
51
|
|
|
* @return Zip |
|
|
|
|
52
|
|
|
* @throws ZipException |
53
|
|
|
* |
54
|
|
|
* @deprecated |
55
|
|
|
* @see self::setSkipMode() |
56
|
|
|
*/ |
57
|
|
|
public function setSkipped(string $mode): ZipInterface { |
58
|
|
|
|
59
|
|
|
return $this->setSkipMode($mode); |
60
|
|
|
|
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Set files to skip |
65
|
|
|
* |
66
|
|
|
* Supported skip modes: |
67
|
|
|
* Zip::SKIP_NONE - skip no files |
68
|
|
|
* Zip::SKIP_HIDDEN - skip hidden files |
69
|
|
|
* Zip::SKIP_ALL - skip HIDDEN + COMODOJO ghost files |
70
|
|
|
* Zip::SKIP_COMODOJO - skip comodojo ghost files |
71
|
|
|
* |
72
|
|
|
* @param string $mode Skip file mode |
73
|
|
|
* |
74
|
|
|
* @return Zip |
75
|
|
|
* @throws ZipException |
76
|
|
|
*/ |
77
|
|
|
public function setSkipMode(string $mode): ZipInterface { |
78
|
|
|
|
79
|
|
|
$mode = strtoupper($mode); |
80
|
|
|
|
81
|
|
|
if ( !in_array($mode, $this->supported_skip_modes) ) { |
|
|
|
|
82
|
|
|
throw new ZipException("Unsupported skip mode: $mode"); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
$this->skip_mode = $mode; |
86
|
|
|
|
87
|
|
|
return $this; |
88
|
|
|
|
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Get current skip mode |
93
|
|
|
* |
94
|
|
|
* @return string |
95
|
|
|
* |
96
|
|
|
* @deprecated |
97
|
|
|
* @see self::getSkipMode() |
98
|
|
|
*/ |
99
|
|
|
public function getSkipped(): string { |
100
|
|
|
|
101
|
|
|
return $this->getSkipMode(); |
102
|
|
|
|
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* Get current skip mode |
108
|
|
|
* |
109
|
|
|
* @return string |
110
|
|
|
*/ |
111
|
|
|
public function getSkipMode(): string { |
112
|
|
|
|
113
|
|
|
return $this->skip_mode; |
114
|
|
|
|
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
} |
118
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths