Completed
Push — master ( 54dd0f...5e6629 )
by Park Jong-Hun
03:04
created

AuthManager::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Auth;
4
5
class AuthManager
6
{
7
    private static $config = [];
8
9
    public static function setConfig(array $config)
10
    {
11
        self::$config = $config;
12
    }
13
14
    public static function isDefaultAllow()
15
    {
16
        return self::$config['defaultAllow'];
17
    }
18
19
    /**
20
     * @return AccountManagerInterface
21
     */
22 View Code Duplication
    public static function getAccountManager($accountManagerName = null)
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...
23
    {
24
        $accountManagerName = $accountManagerName ?: self::$config['defaultAccountManager'];
25
26
        $className = self::$config['accountManagers'][$accountManagerName]['class'];
27
        $settings = self::$config['accountManagers'][$accountManagerName]['settings'];
28
29
        return new $className($settings);
30
    }
31
32
    /**
33
     * @return LoginManagerInterface
34
     */
35 View Code Duplication
    public static function getLoginManager($loginManagerName = null)
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...
36
    {
37
        $loginManagerName = $loginManagerName ?: self::$config['defaultLoginManager'];
38
39
        $className = self::$config['loginManagers'][$loginManagerName]['class'];
40
        $settings = self::$config['loginManagers'][$loginManagerName]['settings'];
41
42
        return new $className($settings);
43
    }
44
}
45