AddSubscriptionHandler::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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