Module::getServiceConfig()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 22
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 22
ccs 10
cts 10
cp 1
rs 9.2
cc 2
eloc 12
nc 1
nop 0
crap 2
1
<?php
2
3
namespace GetStream\Zend;
4
5
use Zend\ModuleManager\Feature\ServiceProviderInterface;
6
7
use GetStream\Stream\Client;
8
use Psr\Container\ContainerInterface;
9
10
class Module implements ServiceProviderInterface
11
{
12
    /**
13
     * @return array
14
     */
15 4
    public function getServiceConfig()
16
    {
17
        return [
18 4
            'factories' => [
19 4
                Client::class => function (ContainerInterface $container) {
20 2
                    $config = $container->get('config');
21
22 2
                    if (isset($config['stream']['url'])) {
23 1
                        return Client::herokuConnect($config['stream']['url']);
24
                    }
25
26 1
                    return new Client(
27 1
                        $config['stream']['app_key'],
28 1
                        $config['stream']['app_secret']
29
                    );
30 4
                },
31
            ],
32
            'shared' => [
33
                Client::class => true,
34
            ],
35
        ];
36
    }
37
}
38