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 string $skip_mode = 'NONE'; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Supported skip modes |
35
|
|
|
* |
36
|
|
|
* @var array |
37
|
|
|
*/ |
38
|
|
|
private array $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
|
|
|
public function setSkipMode(string $mode): ZipInterface { |
55
|
|
|
|
56
|
|
|
$mode = strtoupper($mode); |
57
|
|
|
|
58
|
|
|
if ( !in_array($mode, $this->supported_skip_modes) ) { |
59
|
|
|
throw new ZipException("Unsupported skip mode: $mode"); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
$this->skip_mode = $mode; |
63
|
|
|
|
64
|
|
|
return $this; |
65
|
|
|
|
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Get current skip mode |
70
|
|
|
* |
71
|
|
|
* @return string |
72
|
|
|
*/ |
73
|
|
|
public function getSkipMode(): string { |
74
|
|
|
|
75
|
|
|
return $this->skip_mode; |
76
|
|
|
|
77
|
|
|
} |
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