PreRemoveListener::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 1
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * This file is part of the Cubiche package.
4
 *
5
 * Copyright (c) Cubiche
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Cubiche\Domain\EventSourcing\Tests\Fixtures\Listener;
12
13
use Cubiche\Domain\EventSourcing\Event\PreRemoveEvent;
14
15
/**
16
 * PreRemoveListener class.
17
 *
18
 * @author Ivannis Suárez Jerez <[email protected]>
19
 */
20
class PreRemoveListener
21
{
22
    /**
23
     * @var int
24
     */
25
    protected $version;
26
27
    /**
28
     * PreRemoveListener constructor.
29
     *
30
     * @param int $version
31
     */
32
    public function __construct($version)
33
    {
34
        $this->version = $version;
35
    }
36
37
    /**
38
     * @param PreRemoveEvent $event
39
     */
40
    public function onPreRemove(PreRemoveEvent $event)
41
    {
42
        $event->aggregate()->setVersion($this->version);
43
    }
44
}
45