Completed
Push — master ( b0a3db...81c3f8 )
by Christopher
02:50
created

DepositMoney::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %
Metric Value
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php namespace RayEmitter\Example\BankAccount;
2
3
use C4tech\RayEmitter\Domain\Command;
4
5 View Code Duplication
final class DepositMoney extends Command
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
6
{
7
    /**
8
     * Constructor
9
     *
10
     * @param string $account_id Account identifier.
11
     * @param array  $data       Payload data.
12
     * @param int    $sequence   Expected version sequence.
13
     */
14
    public function __construct($account_id, array $data, $sequence = 0)
15
    {
16
        $this->setupPayload();
17
        $this->target_id = $account_id;
18
        $this->sequence = $sequence;
0 ignored issues
show
Bug introduced by
The property sequence does not seem to exist. Did you mean expected_sequence?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
19
        $this->payload->deposit = $data['deposit'];
20
    }
21
22
    /**
23
     * Run
24
     *
25
     * Push the command into the Aggregate.
26
     * @return void
27
     */
28
    public function run()
29
    {
30
        Aggregate::handle($this);
31
    }
32
}
33