PurchaseControllerTrait::getGatewaysManager()   A
last analyzed

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 2
Bugs 0 Features 2
Metric Value
cc 1
eloc 1
c 2
b 0
f 2
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 1
cp 0
crap 2
rs 10
1
<?php
2
3
namespace ByTIC\Payments\Controllers\Traits;
4
5
use ByTIC\Payments\Controllers\Traits\PurchaseController\PurchaseConfirmActionsTrait;
6
use ByTIC\Payments\Controllers\Traits\PurchaseController\PurchaseIpnActionsTrait;
7
use ByTIC\Payments\Controllers\Traits\PurchaseController\PurchaseRedirectActionsTrait;
8
use ByTIC\Payments\Gateways\Manager as GatewaysManager;
9
use ByTIC\Payments\Models\Purchase\Traits\IsPurchasableModelTrait;
10
use Nip\Records\AbstractModels\Record;
11
use Nip\Records\RecordManager;
12
use Symfony\Component\HttpFoundation\Request;
13
14
/**
15
 * Class PurchaseControllerTrait
16
 * @package ByTIC\Payments\Payments\Controllers\Traits
17
 *
18
 * @method IsPurchasableModelTrait checkItem
19
 */
20
trait PurchaseControllerTrait
21
{
22
    use PurchaseRedirectActionsTrait;
23
    use PurchaseConfirmActionsTrait;
24
    use PurchaseIpnActionsTrait;
25
26
    /**
27
     * @return GatewaysManager
28
     */
29
    protected function getGatewaysManager()
30
    {
31
        return GatewaysManager::instance();
32
    }
33
34
    /**
35
     * @param bool|array $key
36
     * @return Record|IsPurchasableModelTrait
37
     */
38
    abstract protected function getModelFromRequest($key = false);
39
40
    /**
41
     * @return RecordManager
42
     */
43
    abstract protected function getModelManager();
44
45
    /**
46
     * @return Request
47
     */
48
    abstract protected function getRequest();
49
50
    abstract protected function dispatchAccessDeniedResponse();
51
}
52