PreRemoveListener   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 25
rs 10
c 1
b 0
f 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A onPreRemove() 0 4 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