Completed
Push — master ( 18000e...919955 )
by Sébastien
02:06
created

ConfigProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 43
ccs 6
cts 8
cp 0.75
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 4 1
A getDependencies() 0 8 1
A getConsoleCommands() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @see       https://github.com/soluble-io/soluble-mediatools-cli for the canonical repository
7
 * @copyright Copyright (c) 2018-2019 Sébastien Vanvelthem. (https://github.com/belgattitude)
8
 * @license   https://github.com/soluble-io/soluble-mediatools-cli/blob/master/LICENSE.md MIT
9
 */
10
11
namespace Soluble\MediaTools\Cli\Config;
12
13
use Soluble\MediaTools\Cli\Command\ConvertCommand;
14
use Soluble\MediaTools\Cli\Command\ConvertCommandFactory;
15
use Soluble\MediaTools\Cli\Command\ScanCommand;
16
use Soluble\MediaTools\Cli\Command\ScanCommandFactory;
17
use Soluble\MediaTools\Video\Config\ConfigProvider as VideoConfigProvider;
18
19
class ConfigProvider
20
{
21
    /**
22
     * Returns the configuration array.
23
     *
24
     * To add a bit of a structure, each section is defined in a separate
25
     * method which returns an array with its configuration.
26
     */
27 1
    public function __invoke(): array
28
    {
29
        return [
30 1
            'dependencies' => $this->getDependencies(),
31
        ];
32
    }
33
34
    /**
35
     * Returns the container dependencies.
36
     *
37
     * @return array<string, array>
38
     */
39 3
    public function getDependencies(): array
40
    {
41 3
        return array_merge_recursive(
42 3
            (new VideoConfigProvider())->getDependencies(),
43
            [
44 3
                'factories'  => [
45
                    ConvertCommand::class => ConvertCommandFactory::class,
46
                    ScanCommand::class    => ScanCommandFactory::class,
47
                ],
48
            ]
49
        );
50
    }
51
52
    /**
53
     * Return build console commands class names.
54
     *
55
     * @return string[]
56
     */
57
    public function getConsoleCommands(): array
58
    {
59
        return [
60
            \Soluble\MediaTools\Cli\Command\ScanCommand::class,
61
            \Soluble\MediaTools\Cli\Command\ConvertCommand::class,
62
        ];
63
    }
64
}
65