Passed
Push — master ( c2faf8...afa411 )
by Al3x
11:51
created

AuthOptionsFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 4
c 1
b 0
f 1
nc 1
nop 3
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 1
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace InvoiceNinjaModule\Options;
5
6
use Interop\Container\ContainerInterface;
7
use InvoiceNinjaModule\Module;
8
use Laminas\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