Failed Conditions
Pull Request — experimental/sf (#3247)
by Kiyotaka
114:07 queued 103:28
created

ItemHolderValidator::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 0
cts 0
cp 0
crap 2
1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.lockon.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;
15
16
use Eccube\Entity\ItemHolderInterface;
17
18
/**
19
 * カート/受注の妥当性検証を行う.
20
 */
21
abstract class ItemHolderValidator
0 ignored issues
show
introduced by
Abstract class name is not prefixed with "Abstract"
Loading history...
22
{
23
    use ValidatorTrait;
24
25
    /**
26
     * @param ItemHolderInterface $itemHolder
27
     * @param PurchaseContext     $context
28
     *
29
     * @return ProcessResult
30
     */
31 230
    final public function execute(ItemHolderInterface $itemHolder, PurchaseContext $context)
32
    {
33
        try {
34 230
            $this->validate($itemHolder, $context);
35
36 223
            return ProcessResult::success();
37 14
        } catch (InvalidItemException $e) {
38 14
            return ProcessResult::error($e->getMessage());
39
        }
40
    }
41
42
    /**
43
     * @param ItemHolderInterface $itemHolder
44
     * @param PurchaseContext $context
45
     *
46
     * @throws InvalidItemException
47
     */
48
    abstract protected function validate(ItemHolderInterface $itemHolder, PurchaseContext $context);
49
50
    protected function handle(ItemHolderInterface $itemHolder)
0 ignored issues
show
Unused Code introduced by
The parameter $itemHolder is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
51
    {
52
    }
53
}
54