1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Comodojo\Zip\Traits; |
4
|
|
|
|
5
|
|
|
use \Comodojo\Zip\Interfaces\ZipInterface; |
6
|
|
|
use \Comodojo\Exception\ZipException; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Skip mode helper trait. |
10
|
|
|
* |
11
|
|
|
* @package Comodojo Zip |
12
|
|
|
* @author Marco Giovinazzi <[email protected]> |
13
|
|
|
* @license MIT |
14
|
|
|
* |
15
|
|
|
* LICENSE: |
16
|
|
|
* |
17
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
18
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
19
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
20
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
21
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
22
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
23
|
|
|
* THE SOFTWARE. |
24
|
|
|
*/ |
25
|
|
|
|
26
|
|
|
trait SkipTrait |
27
|
|
|
{ |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Select files to skip |
31
|
|
|
* |
32
|
|
|
* @var string |
33
|
|
|
*/ |
34
|
|
|
private string $skip_mode = 'NONE'; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Supported skip modes |
38
|
|
|
* |
39
|
|
|
* @var array |
40
|
|
|
*/ |
41
|
|
|
private array $supported_skip_modes = ['NONE', 'HIDDEN', 'ALL', 'COMODOJO']; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Set files to skip |
45
|
|
|
* |
46
|
|
|
* Supported skip modes: |
47
|
|
|
* Zip::SKIP_NONE - skip no files |
48
|
|
|
* Zip::SKIP_HIDDEN - skip hidden files |
49
|
|
|
* Zip::SKIP_ALL - skip HIDDEN + COMODOJO ghost files |
50
|
|
|
* Zip::SKIP_COMODOJO - skip comodojo ghost files |
51
|
|
|
* |
52
|
|
|
* @param string $mode Skip file mode |
53
|
|
|
* |
54
|
|
|
* @return Zip |
|
|
|
|
55
|
|
|
* @throws ZipException |
56
|
|
|
*/ |
57
|
2 |
|
public function setSkipMode(string $mode): ZipInterface |
58
|
|
|
{ |
59
|
2 |
|
$mode = strtoupper($mode); |
60
|
|
|
|
61
|
2 |
|
if (!in_array($mode, $this->supported_skip_modes)) { |
62
|
1 |
|
throw new ZipException("Unsupported skip mode: $mode"); |
63
|
|
|
} |
64
|
|
|
|
65
|
1 |
|
$this->skip_mode = $mode; |
66
|
|
|
|
67
|
1 |
|
return $this; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Get current skip mode |
72
|
|
|
* |
73
|
|
|
* @return string |
74
|
|
|
*/ |
75
|
1 |
|
public function getSkipMode(): string |
76
|
|
|
{ |
77
|
1 |
|
return $this->skip_mode; |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|
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