Failed Conditions
Pull Request — experimental/sf (#3236)
by Kentaro
49:41 queued 37:58
created

ValidatableEmptyProcessor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 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 Plugin\PurchaseProcessors\Processor;
15
16
use Eccube\Entity\ItemInterface;
17
use Eccube\Service\PurchaseFlow\InvalidItemException;
18
use Eccube\Service\PurchaseFlow\PurchaseContext;
19
use Eccube\Service\PurchaseFlow\ValidatableItemProcessor;
20
21
class ValidatableEmptyProcessor extends ValidatableItemProcessor
22
{
23
    protected function validate(ItemInterface $item, PurchaseContext $context)
24
    {
25
        $error = false;
26
        if ($error) {
27
            throw new InvalidItemException('ValidatableEmptyProcessorのエラーです');
28
        }
29
    }
30
31
    protected function handle(ItemInterface $item, PurchaseContext $context)
32
    {
33
        $item->setQuantity(100);
34
    }
35
}
36