ConfigProvider::getModuleConfig()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 14
ccs 2
cts 2
cp 1
crap 1
rs 9.7998
c 0
b 0
f 0
1
<?php
2
3
namespace SwaggerMiddleware;
4
5
use Zend\ServiceManager\Factory\InvokableFactory;
6
7
/**
8
 * The configuration provider for the SwaggerMiddleware module
9
 *
10
 * @see https://docs.zendframework.com/zend-component-installer/
11
 */
12
class ConfigProvider
13
{
14
    /**
15
     * Returns the configuration array
16
     *
17
     * To add a bit of a structure, each section is defined in a separate
18
     * method which returns an array with its configuration.
19
     *
20
     * @return array
21
     */
22 3
    public function __invoke()
23
    {
24
        return [
25 3
            'dependencies' => $this->getDependencies(),
26 3
            'swagger-middleware' => $this->getModuleConfig(),
27
        ];
28
    }
29
30
    /**
31
     * Returns the container dependencies
32
     *
33
     * @return array
34
     */
35 3
    public function getDependencies() : array
36
    {
37
        return [
38 2
            'factories'  => [
39 1
                Generator::class => GeneratorFactory::class,
40
                Middleware\ApiSpecification::class => Middleware\ApiSpecificationFactory::class,
41
                Middleware\SwaggerUIAssets::class => InvokableFactory::class,
42
                Middleware\SwaggerUI::class => Middleware\SwaggerUIFactory::class,
43
            ],
44
        ];
45
    }
46
47 3
    public function getModuleConfig() : array
48
    {
49
        return [
50 3
            'title' => 'API Spec',
51
            'scan' => [
52
                'paths' => [],
53
                'options' => [],
54
            ],
55
            'routes' => [
56
                'specification' => '/docs/spec.json',
57
                'assets' => '/docs/assets/',
58
            ],
59
        ];
60
    }
61
}
62