These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php namespace RayEmitter\Example\BankAccount; |
||
2 | |||
3 | use C4tech\RayEmitter\Domain\Command; |
||
4 | |||
5 | View Code Duplication | final class WithdrawMoney extends Command |
|
0 ignored issues
–
show
|
|||
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
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->withdrawal = $data['withdrawal']; |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * Run |
||
24 | * |
||
25 | * Push the command into the Aggregate. |
||
26 | * @return void |
||
27 | */ |
||
28 | public function run() |
||
29 | { |
||
30 | Repository::handle($this); |
||
31 | } |
||
32 | } |
||
33 |
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.