WorkerApplication::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 0
cts 7
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 3
crap 6
1
<?php
2
3
namespace JobQueue\Application\Console;
4
5
use JobQueue\Domain\Task\Queue;
6
use Psr\Log\LoggerInterface;
7
use Symfony\Component\Console\Application;
8
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
9
10
final class WorkerApplication extends Application
11
{
12
    /**
13
     *
14
     * @param Queue                    $queue
15
     * @param EventDispatcherInterface $eventDispatcher
16
     * @param LoggerInterface|null     $logger
17
     */
18
    public function __construct(Queue $queue, EventDispatcherInterface $eventDispatcher, LoggerInterface $logger = null)
19
    {
20
        parent::__construct('worker', 1.0);
21
22
        $consumeCommand = new Consume($queue, $eventDispatcher);
23
        if ($logger) {
24
            $consumeCommand->setLogger($logger);
25
        }
26
27
        $this->add($consumeCommand);
28
        $this->setDefaultCommand('consume', true);
29
    }
30
}
31