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

PaymentServiceProvider::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 15
nc 1
nop 1
dl 0
loc 23
rs 9.0856
c 0
b 0
f 0
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
}