Completed
Pull Request — 4.0 (#4223)
by Kentaro
04:57
created

PaymentTotalNegativeValidator::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 0
cp 0
crap 2
rs 10
c 0
b 0
f 0
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\Service\PurchaseFlow\InvalidItemException;
18
use Eccube\Service\PurchaseFlow\ItemHolderPostValidator;
19
use Eccube\Service\PurchaseFlow\PurchaseContext;
20
21
/**
22
 * 合計金額のマイナスチェック.
23
 */
24
class PaymentTotalNegativeValidator extends ItemHolderPostValidator
25
{
26
    /**
27
     * @param ItemHolderInterface $itemHolder
28
     * @param PurchaseContext $context
29
     *
30
     * @throws InvalidItemException
31
     */
32 78
    protected function validate(ItemHolderInterface $itemHolder, PurchaseContext $context)
33
    {
34 78
        if ($itemHolder->getTotal() < 0) {
35 1
            $this->throwInvalidItemException(trans('front.shopping.payment_total_invalid'));
36
        }
37
    }
38
39
    public function __toString()
40
    {
41
        return get_class($this);
42
    }
43
}
44