Passed
Push — v7 ( 41e516...4ee131 )
by Georges
01:39
created

IOConfigurationOptionTrait::setSecurityKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Geolim4
5
 * Date: 10/02/2018
6
 * Time: 18:45
7
 */
8
9
namespace Phpfastcache\Config;
10
11
use Phpfastcache\Exceptions\PhpfastcacheInvalidArgumentException;
12
use Phpfastcache\Exceptions\PhpfastcacheInvalidConfigurationException;
13
use Phpfastcache\Util\ArrayObject;
14
15
trait IOConfigurationOptionTrait
16
{
17
    /**
18
     * @var boolean
19
     */
20
    protected $secureFileManipulation = false;
21
22
    /**
23
     * @var string
24
     */
25
    protected $htaccess = true;
26
27
    /**
28
     * @var string
29
     */
30
    protected $securityKey = '';
31
32
    /**
33
     * @return string
34
     */
35
    public function getSecurityKey(): string
36
    {
37
        return $this->securityKey;
38
    }
39
40
    /**
41
     * @param string $securityKey
42
     * @return Config
43
     */
44
    public function setSecurityKey(string $securityKey): self
45
    {
46
        $this->securityKey = $securityKey;
47
48
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Phpfastcache\Config\IOConfigurationOptionTrait which is incompatible with the documented return type Phpfastcache\Config\Config.
Loading history...
49
    }
50
51
    /**
52
     * @return bool
53
     */
54
    public function getHtaccess(): bool
55
    {
56
        return $this->htaccess;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->htaccess returns the type string which is incompatible with the type-hinted return boolean.
Loading history...
57
    }
58
59
    /**
60
     * @param bool $htaccess
61
     * @return Config
62
     */
63
    public function setHtaccess(bool $htaccess): self
64
    {
65
        $this->htaccess = $htaccess;
0 ignored issues
show
Documentation Bug introduced by
The property $htaccess was declared of type string, but $htaccess is of type boolean. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
66
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Phpfastcache\Config\IOConfigurationOptionTrait which is incompatible with the documented return type Phpfastcache\Config\Config.
Loading history...
67
    }
68
69
    /**
70
     * @return bool
71
     */
72
    public function isSecureFileManipulation(): bool
73
    {
74
        return $this->secureFileManipulation;
75
    }
76
77
    /**
78
     * @param bool $secureFileManipulation
79
     * @return self
80
     */
81
    public function setSecureFileManipulation(bool $secureFileManipulation): self
82
    {
83
        $this->secureFileManipulation = $secureFileManipulation;
84
        return $this;
85
    }
86
}