These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of EC-CUBE |
||
5 | * |
||
6 | * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. |
||
7 | * |
||
8 | * http://www.ec-cube.co.jp/ |
||
9 | * |
||
10 | * For the full copyright and license information, please view the LICENSE |
||
11 | * file that was distributed with this source code. |
||
12 | */ |
||
13 | |||
14 | namespace Eccube\Service\PurchaseFlow\Processor; |
||
15 | |||
16 | use Eccube\Entity\ItemHolderInterface; |
||
17 | use Eccube\Entity\Order; |
||
18 | use Eccube\Service\PurchaseFlow\InvalidItemException; |
||
19 | use Eccube\Service\PurchaseFlow\ItemHolderPostValidator; |
||
20 | use Eccube\Service\PurchaseFlow\PurchaseContext; |
||
21 | |||
22 | /** |
||
23 | * 手数料が変更されたかどうかを検知するバリデータ. |
||
24 | */ |
||
25 | View Code Duplication | class PaymentChargeChangeValidator extends ItemHolderPostValidator |
|
26 | { |
||
27 | /** |
||
28 | * @param ItemHolderInterface $itemHolder |
||
29 | * @param PurchaseContext $context |
||
30 | * |
||
31 | * @throws InvalidItemException |
||
32 | */ |
||
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()) { |
||
0 ignored issues
–
show
|
|||
44 | return; |
||
45 | } |
||
46 | |||
47 | if ($originHolder->getCharge() != $itemHolder->getCharge()) { |
||
48 | $this->throwInvalidItemException('purchase_flow.charge_update', null, true); |
||
49 | } |
||
50 | } |
||
51 | } |
||
52 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: