AbstractValidator::setRefreshFlow()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2
Metric Value
dl 0
loc 6
ccs 0
cts 3
cp 0
rs 9.4286
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Tymon\JWTAuth\Validators;
4
5
use Tymon\JWTAuth\Exceptions\JWTException;
6
7
abstract class AbstractValidator implements ValidatorInterface
8
{
9
    /**
10
     * @var bool
11
     */
12
    protected $refreshFlow = false;
13
14
    /**
15
     * Helper function to return a boolean
16
     *
17
     * @param  array  $value
18
     * @return bool
19
     */
20 9
    public function isValid($value)
21
    {
22
        try {
23 9
            $this->check($value);
24 7
        } catch (JWTException $e) {
25 3
            return false;
26
        }
27
28 6
        return true;
29
    }
30
31
    /**
32
     * Set the refresh flow flag
33
     *
34
     * @param  bool  $refreshFlow
35
     * @return $this
36
     */
37
    public function setRefreshFlow($refreshFlow = true)
38
    {
39
        $this->refreshFlow = $refreshFlow;
40
41
        return $this;
42
    }
43
}
44