Completed
Push — master ( 1a8c72...81e1ab )
by Marco
12:55
created

MaskTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 39
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setMask() 0 12 1
A getMask() 0 3 1
1
<?php namespace Comodojo\Zip\Traits;
2
3
use \Comodojo\Zip\Interfaces\ZipInterface;
4
5
/**
6
 * File mask helper trait.
7
 *
8
 * @package     Comodojo Zip
9
 * @author      Marco Giovinazzi <[email protected]>
10
 * @license     MIT
11
 *
12
 * LICENSE:
13
 *
14
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
 * THE SOFTWARE.
21
 */
22
23
trait MaskTrait {
24
25
    /**
26
     * Mask for the extraction folder (if it should be created)
27
     *
28
     * @var int
29
     */
30
    private $mask = 0777;
31
32
    /**
33
     * Set the mask of the extraction folder
34
     *
35
     * @param int $mask Integer representation of the file mask
36
     *
37
     * @return Zip
0 ignored issues
show
Bug introduced by
The type Comodojo\Zip\Traits\Zip 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...
38
     */
39
    public function setMask(int $mask): ZipInterface {
40
41
        $mask = filter_var($mask, FILTER_VALIDATE_INT, [
42
            "options" => [
43
                "max_range" => 0777,
44
                "default" => 0777
45
            ],
46
            'flags' => FILTER_FLAG_ALLOW_OCTAL
47
        ]);
48
        $this->mask = $mask;
49
50
        return $this;
51
52
    }
53
54
    /**
55
     * Get current mask of the extraction folder
56
     *
57
     * @return int
58
     */
59
    public function getMask(): int {
60
61
        return $this->mask;
62
63
    }
64
65
}
66