AddSubscriptionHandler::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 7
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace PersonalGalaxy\RSS\Handler;
5
6
use PersonalGalaxy\RSS\{
7
    Command\AddSubscription,
8
    Entity\Subscription,
9
    Repository\SubscriptionRepository,
10
};
11
12
final class AddSubscriptionHandler
13
{
14
    private $repository;
15
16 1
    public function __construct(SubscriptionRepository $repository)
17
    {
18 1
        $this->repository = $repository;
19 1
    }
20
21 1
    public function __invoke(AddSubscription $wished): void
22
    {
23 1
        $this->repository->add(Subscription::add(
24 1
            $wished->identity(),
25 1
            $wished->user(),
26 1
            $wished->name(),
27 1
            $wished->location()
28
        ));
29 1
    }
30
}
31