Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Lines | 18 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
33 | protected function validate(ItemHolderInterface $itemHolder, PurchaseContext $context) |
||
34 | { |
||
35 | if (!$itemHolder instanceof Order) { |
||
36 | return; |
||
37 | } |
||
38 | |||
39 | /** @var Order $originHolder */ |
||
40 | $originHolder = $context->getOriginHolder(); |
||
41 | |||
42 | // 受注の生成直後はチェックしない. |
||
43 | if (!$originHolder->getOrderNo()) { |
||
44 | return; |
||
45 | } |
||
46 | |||
47 | if ($originHolder->getCharge() != $itemHolder->getCharge()) { |
||
48 | $this->throwInvalidItemException('手数料が更新されました。金額をご確認ください。', null, true); |
||
49 | } |
||
50 | } |
||
51 | } |
||
52 |
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.