Completed
Pull Request — master (#281)
by Kristof
04:31
created

ConcludeCommandHandler::handleConclude()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace CultuurNet\UDB3\Event;
4
5
use Broadway\Repository\RepositoryInterface;
6
use CultuurNet\UDB3\CommandHandling\Udb3CommandHandler;
7
use CultuurNet\UDB3\Event\Commands\Conclude;
8
9
class ConcludeCommandHandler extends Udb3CommandHandler
10
{
11
    /**
12
     * @var RepositoryInterface
13
     */
14
    protected $offerRepository;
15
16
    /**
17
     * ConcludeCommandHandler constructor.
18
     *
19
     * @param RepositoryInterface $offerRepository
20
     */
21
    public function __construct(RepositoryInterface $offerRepository)
22
    {
23
        $this->offerRepository = $offerRepository;
24
    }
25
26
    public function handleConclude(Conclude $conclude)
27
    {
28
        /** @var Event $event */
29
        $event = $this->offerRepository->load($conclude->getItemId());
30
31
        $event->conclude();
32
33
        $this->offerRepository->save($event);
34
    }
35
}
36