Passed
Push — master ( ff7474...c002dd )
by Gabriel
05:50
created

updateParametersFromPurchase()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 2
rs 10
1
<?php
2
3
namespace ByTIC\Payments\Gateways\Providers\AbstractGateway\Message\Traits;
4
5
use Omnipay\Common\AbstractGateway;
6
use ByTIC\Payments\Models\Purchase\Traits\IsPurchasableModelTrait;
7
8
/**
9
 * Trait HasGatewayParamsRequestTrait
10
 * @package ByTIC\Payments\Gateways\Providers\AbstractGateway\Message\Traits
11
 */
12
trait HasGatewayRequestTrait
13
{
14
    /**
15
     * @param IsPurchasableModelTrait $model
16
     */
17 7
    protected function updateParametersFromPurchase($model)
18
    {
19
        /** @var AbstractGateway $gateway */
20 7
        $gateway = $model->getPaymentMethod()->getType()->getGateway();
0 ignored issues
show
Bug introduced by
The method getGateway() does not exist on ByTIC\Payments\Models\Methods\Types\AbstractType. It seems like you code against a sub-type of ByTIC\Payments\Models\Methods\Types\AbstractType such as ByTIC\Payments\Models\Methods\Types\CreditCards. ( Ignorable by Annotation )

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

20
        $gateway = $model->getPaymentMethod()->getType()->/** @scrutinizer ignore-call */ getGateway();
Loading history...
21
22 7
        if ($gateway) {
0 ignored issues
show
introduced by
$gateway is of type Omnipay\Common\AbstractGateway, thus it always evaluated to true.
Loading history...
23 7
            $this->updateParametersFromGateway($gateway);
24
        }
25 7
    }
26
27
    /**
28
     * @param AbstractGateway $gateway
29
     * @return void
30
     */
31
    abstract protected function updateParametersFromGateway($gateway);
32
}