Passed
Push — master ( 08ce64...4483b1 )
by Mike
02:47
created

SecurityDependencyProvider::addAuthenticatorList()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 7
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace Xervice\Security;
5
6
7
use Xervice\Core\Business\Model\Dependency\DependencyContainerInterface;
8
use Xervice\Core\Business\Model\Dependency\Provider\AbstractDependencyProvider;
9
10
class SecurityDependencyProvider extends AbstractDependencyProvider
11
{
12
    public const AUTHENTICATOR_LIST = 'authenticator.list';
13
14
    /**
15
     * @param \Xervice\Core\Business\Model\Dependency\DependencyContainerInterface $container
16
     *
17
     * @return \Xervice\Core\Business\Model\Dependency\DependencyContainerInterface
18
     */
19 1
    public function handleDependencies(DependencyContainerInterface $container): DependencyContainerInterface
20
    {
21 1
        $container = $this->addAuthenticatorList($container);
22
23 1
        return $container;
24
    }
25
26
    /**
27
     * Give a list of valid authenticator (string => AuthenticatorInterface::class)
28
     * e.g.
29
     * token => tokenAuthenticator::class
30
     *
31
     * @return array
32
     */
33
    protected function getAuthenticatorList(): array
34
    {
35
        return [];
36
    }
37
38
    /**
39
     * @param \Xervice\Core\Business\Model\Dependency\DependencyContainerInterface $container
40
     *
41
     * @return \Xervice\Core\Business\Model\Dependency\DependencyContainerInterface
42
     */
43 1
    protected function addAuthenticatorList(
44
        DependencyContainerInterface $container
45
    ): DependencyContainerInterface {
46
        $container[self::AUTHENTICATOR_LIST] = function () {
47 1
            return $this->getAuthenticatorList();
48
        };
49 1
        return $container;
50
    }
51
}
52