Passed
Push — master ( cfa70a...460ec1 )
by Gabriel
11:48
created

PaymentsServiceProvider::setPurchaseSessionsModel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace ByTIC\Payments;
4
5
use ByTIC\Payments\Gateways\Manager;
6
use ByTIC\Payments\Utility\PaymentsModels;
7
use Nip\Container\ServiceProviders\Providers\AbstractSignatureServiceProvider;
8
use Nip\Records\Locator\ModelLocator;
9
10
/**
11
 * Class PaymentsServiceProvider
12
 * @package ByTIC\Payments
13
 */
14
class PaymentsServiceProvider extends AbstractSignatureServiceProvider
15
{
16
    /**
17
     * @inheritdoc
18
     */
19
    public function register()
20
    {
21 1
        $this->registerPurchases();
22
        $this->registerGatewaysManager();
23 1
        $this->registerPurchaseSessions();
24 1
    }
25 1
26 1
    protected function registerPurchases()
27
    {
28
        $this->getContainer()->share('purchases', function () {
29
            return PaymentsModels::purchases();
30 1
        });
31 1
    }
32 1
33 1
    protected function registerPurchaseSessions()
34
    {
35
        $this->getContainer()->share('purchase-sessions', function () {
36
            return PaymentsModels::sessions();
37 1
        });
38
    }
39 1
40 1
    protected function registerGatewaysManager()
41
    {
42
        $this->getContainer()->singleton('payments.gateways', function () {
0 ignored issues
show
Bug introduced by
The method singleton() does not exist on Nip\Container\ContainerInterface. It seems like you code against a sub-type of Nip\Container\ContainerInterface such as Nip\Container\Container or Nip\Container\Container. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

42
        $this->getContainer()->/** @scrutinizer ignore-call */ singleton('payments.gateways', function () {
Loading history...
43
            return new Manager();
44 1
        });
45
    }
46 1
47 1
    /**
48
     * @inheritdoc
49
     */
50
    public function provides()
51
    {
52 1
        return ['purchases', 'purchase-sessions','payments.gateways'];
53
    }
54
}
55