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 DepositMoney 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; |
||
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 | 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.