Completed
Push — master ( 1341d4...acf296 )
by Alejandro
14:18 queued 10:22
created

ApplicationFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 7
c 0
b 0
f 0
dl 0
loc 12
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 10 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Shlinkio\Shlink\CLI\Factory;
5
6
use Interop\Container\ContainerInterface;
7
use Shlinkio\Shlink\Core\Options\AppOptions;
8
use Symfony\Component\Console\Application as CliApp;
9
use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
10
11
class ApplicationFactory
12
{
13 1
    public function __invoke(ContainerInterface $container): CliApp
14
    {
15 1
        $config = $container->get('config')['cli'];
16 1
        $appOptions = $container->get(AppOptions::class);
17
18 1
        $commands = $config['commands'] ?? [];
19 1
        $app = new CliApp($appOptions->getName(), $appOptions->getVersion());
20 1
        $app->setCommandLoader(new ContainerCommandLoader($container, $commands));
21
22 1
        return $app;
23
    }
24
}
25