AbstractValidator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 62.5%

Importance

Changes 4
Bugs 2 Features 0
Metric Value
wmc 3
c 4
b 2
f 0
lcom 0
cbo 0
dl 0
loc 37
ccs 5
cts 8
cp 0.625
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isValid() 0 10 2
A setRefreshFlow() 0 6 1
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