SyncCommandFactory::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 10
rs 10
ccs 6
cts 6
cp 1
cc 1
nc 1
nop 3
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace TogglJira\Command;
5
6
use Interop\Container\ContainerInterface;
7
use TogglJira\Options\SyncOptions;
8
use TogglJira\Service\SyncService;
9
use Zend\Config\Writer\Json;
10
use Zend\ServiceManager\Factory\FactoryInterface;
11
12
class SyncCommandFactory implements FactoryInterface
13
{
14
15
    /**
16
     * {@inheritdoc}
17
     * @throws \Exception
18
     */
19 1
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null): SyncCommand
20
    {
21
        /** @var SyncOptions $options */
22 1
        $syncOptions = $container->get(SyncOptions::class);
23 1
        $writer = new Json();
24
        
25 1
        $command = new SyncCommand($container->get(SyncService::class), $syncOptions, $writer);
26 1
        $command->setLogger($container->get('Logger'));
27
28 1
        return $command;
29
    }
30
}
31