Completed
Push — master ( f5307d...1d12dd )
by Park Jong-Hun
47:54 queued 44:20
created

FileBaseAccountManager::isExistAccountId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace App\Auth\AccountManager;
4
5
use App\Auth\AccountManagerInterface;
6
7
class FileBaseAccountManager implements AccountManagerInterface
8
{
9
    private $accounts = [];
10
11
    public function __construct($settings = [])
12
    {
13
        $this->accounts = $settings['accounts'];
14
    }
15
16
    public function isExistAccountId($accountId)
17
    {
18
        return isset($this->accounts[$accountId]);
19
    }
20
21 View Code Duplication
    public function isEqualPassword($accountId, $password)
0 ignored issues
show
Duplication introduced by
This method 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...
22
    {
23
        if ($this->isExistAccountId($accountId) === false) {
24
            return false;
25
        }
26
27
        return $this->accounts[$accountId]['password'] === $password;
28
    }
29
30 View Code Duplication
    public function getRole($accountId)
0 ignored issues
show
Duplication introduced by
This method 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...
31
    {
32
        if ($this->isExistAccountId($accountId) === false) {
33
            return null;
34
        }
35
36
        return $this->accounts[$accountId]['role'];
37
    }
38
}
39