This class seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
10
{
11
/**
12
* @var string
13
*/
14
private $path;
15
16
/**
17
* @var array
18
*/
19
private $cache = [];
20
21
/**
22
* @param string $path
23
*/
24
public function __construct($path)
25
{
26
$this->path = (string)$path . '/tokens';
27
}
28
29
/**
30
* @inheritdoc
31
*/
32
public function load(TokenType $type)
33
{
34
if (!file_exists($this->path . '/' . $type->toString())) {
35
throw new TokenNotFoundException($type, $this->path);
36
}
37
38
$token = $this->loadToken($type);
39
40
return DefaultToken::fromString($token);
41
}
42
43
/**
44
* @inheritdoc
45
*/
46
public function save(Token $token, TokenType $type)
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.