PhpArrayFactory::createService()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 11
rs 9.4285
cc 3
eloc 6
nc 2
nop 1
1
<?php
2
3
namespace T4web\Authentication\Adapter;
4
5
use Zend\ServiceManager\ServiceLocatorInterface;
6
use Zend\ServiceManager\FactoryInterface;
7
8
class PhpArrayFactory implements FactoryInterface
9
{
10
    /**
11
     * @param ServiceLocatorInterface $serviceLocator
12
     * @return PhpArray
13
     */
14
    public function createService(ServiceLocatorInterface $serviceLocator)
15
    {
16
        $config = $serviceLocator->get('Config');
17
18
        $authAccounts = [];
19
        if (isset($config['auth-accounts']) && is_array($config['auth-accounts'])) {
20
            $authAccounts = $config['auth-accounts'];
21
        }
22
23
        return new PhpArray($authAccounts);
24
    }
25
}
26