FlapIntervalTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 4
dl 0
loc 13
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setFlapInterval() 0 3 1
A getFlapInterval() 0 3 1
1
<?php namespace Comodojo\Cache\Traits;
2
3
use \Comodojo\Foundation\Validation\DataFilter;
4
5
/**
6
 * @package     Comodojo Cache
7
 * @author      Marco Giovinazzi <[email protected]>
8
 * @license     MIT
9
 *
10
 * LICENSE:
11
 *
12
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
18
 * THE SOFTWARE.
19
 */
20
21
trait FlapIntervalTrait {
22
23
    protected $flap_interval = 600;
24
25 81
    public function setFlapInterval($interval) {
26
27 81
        $this->flap_interval = DataFilter::filterInteger($interval, 1, PHP_INT_MAX, 600);
0 ignored issues
show
Bug introduced by
Comodojo\Cache\Traits\PHP_INT_MAX of type integer is incompatible with the type array expected by parameter $max of Comodojo\Foundation\Vali...Filter::filterInteger(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

27
        $this->flap_interval = DataFilter::filterInteger($interval, 1, /** @scrutinizer ignore-type */ PHP_INT_MAX, 600);
Loading history...
Bug introduced by
600 of type integer is incompatible with the type array expected by parameter $default of Comodojo\Foundation\Vali...Filter::filterInteger(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

27
        $this->flap_interval = DataFilter::filterInteger($interval, 1, PHP_INT_MAX, /** @scrutinizer ignore-type */ 600);
Loading history...
Bug introduced by
1 of type integer is incompatible with the type array expected by parameter $min of Comodojo\Foundation\Vali...Filter::filterInteger(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

27
        $this->flap_interval = DataFilter::filterInteger($interval, /** @scrutinizer ignore-type */ 1, PHP_INT_MAX, 600);
Loading history...
28
29 81
    }
30
31 2
    public function getFlapInterval() {
32
33 2
        return $this->flap_interval;
34
35
    }
36
37
}
38