Completed
Push — experimental/3.1 ( 24445a...d4772e )
by Yangsin
271:33 queued 265:16
created

PaymentServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 23 1
1
<?php
2
3
namespace Eccube\ServiceProvider;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Eccube\Repository\DeliveryRepository;
7
use Eccube\Service\PurchaseFlow\Processor\DisplayStatusValidator;
8
use Eccube\Service\PurchaseFlow\Processor\StockValidator;
9
use Eccube\Service\PurchaseFlow\PurchaseFlow;
10
use Pimple\Container;
11
use Pimple\ServiceProviderInterface;
12
13
class PaymentServiceProvider implements ServiceProviderInterface
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
14
{
15
    public function register(Container $app)
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
16
    {
17
        $app['payment.method'] = $app->protect(function ($clazz, $form) use ($app) {
18
            $PaymentMethod = new $clazz;
0 ignored issues
show
introduced by
Use parentheses when instantiating classes
Loading history...
19
            $PaymentMethod->setApplication($app);
20
            $PaymentMethod->setFormType($form);
21
            return $PaymentMethod;
0 ignored issues
show
introduced by
Missing blank line before return statement
Loading history...
22
        });
23
24
        $app['payment.method.request'] = $app->protect(function ($clazz, $form, $request) use ($app) {
25
            $PaymentMethod = new $clazz;
0 ignored issues
show
introduced by
Use parentheses when instantiating classes
Loading history...
26
            $PaymentMethod->setApplication($app);
27
            $PaymentMethod->setFormType($form);
28
            $PaymentMethod->setRequest($request);
29
            return $PaymentMethod;
0 ignored issues
show
introduced by
Missing blank line before return statement
Loading history...
30
        });
31
32
        $app['eccube.service.payment'] = $app->protect(function ($clazz) use ($app) {
33
            $Service = new $clazz($app['request_stack']);
34
35
            return $Service;
36
        });
37
    }
38
}