Failed Conditions
Push — experimental/3.1 ( 965511...751c7a )
by chihiro
21s
created

ValidatableItemHolderProcessor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A process() 0 10 2
validate() 0 1 ?
A handle() 0 3 1
1
<?php
2
3
namespace Eccube\Service\PurchaseFlow;
4
5
use Eccube\Entity\ItemHolderInterface;
6
7
abstract class ValidatableItemHolderProcessor implements ItemHolderProcessor
0 ignored issues
show
introduced by
Abstract class name is not prefixed with "Abstract"
Loading history...
introduced by
Missing class doc comment
Loading history...
8
{
9
    /**
10
     * @param ItemHolderInterface $itemHolder
11
     * @param PurchaseContext     $context
12
     *
13
     * @return ProcessResult
14
     */
15
    final public function process(ItemHolderInterface $itemHolder, PurchaseContext $context)
16
    {
17
        try {
18
            $this->validate($itemHolder, $context);
19
20
            return ProcessResult::success();
21
        } catch (ItemValidateException $e) {
22
            return ProcessResult::error($e->getMessage());
23
        }
24
    }
25
26
    abstract protected function validate(ItemHolderInterface $itemHolder, PurchaseContext $context);
27
28
    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...
29
    {
30
    }
31
}
32