Completed
Push — master ( 7a3efc...f79493 )
by Al3x
02:58
created

AuthOptionsFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
rs 9.4285
ccs 5
cts 5
cp 1
cc 1
eloc 5
nc 1
nop 3
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace InvoiceNinjaModule\Options;
5
6
use Interop\Container\ContainerInterface;
7
use InvoiceNinjaModule\Module;
8
use Zend\ServiceManager\Factory\FactoryInterface;
9
10
/**
11
 * Class AuthOptionsFactory
12
 */
13
class AuthOptionsFactory implements FactoryInterface
14
{
15 2
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
16
    {
17 2
        $config = $container->get('Config');
18 2
        $settingsArr = $config[Module::INVOICE_NINJA_CONFIG] ?? [];
19 2
        $authArr = $settingsArr[Module::AUTHORIZATION] ?? [];
20 2
        return new AuthOptions($authArr);
21
    }
22
}
23