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

CompletePurchaseRequestTrait::getData()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 2
rs 10
1
<?php
2
3
namespace ByTIC\Payments\Gateways\Providers\Payu\Message\Traits;
4
5
use ByTIC\Payments\Gateways\Providers\AbstractGateway\Message\Traits\HasGatewayRequestTrait;
6
use ByTIC\Payments\Gateways\Providers\AbstractGateway\Message\Traits\HasModelRequest;
7
8
/**
9
 * Trait CompletePurchaseRequestTrait
10
 * @package ByTIC\Payments\Gateways\Providers\Payu\Message\Traits
11
 */
12
trait CompletePurchaseRequestTrait
13
{
14
    use HasGatewayRequestTrait;
15
    use HasModelRequest;
16
17
    /**
18
     * @inheritdoc
19
     */
20 3
    public function getData()
21
    {
22 3
        $return = parent::getData();
23
        // Add model only if has data
24 3
        if (count($return)) {
25 3
            $return['model'] = $this->getModel();
26
        }
27
28 3
        return $return;
29
    }
30
31
    /**
32
     * @param \ByTIC\Payments\Gateways\Providers\Payu\Gateway $model
33
     */
34 3
    protected function updateParametersFromGateway($gateway)
35
    {
36
//        $this->setMerchant($gateway->getMerchant());
37 3
        $this->setSecretKey($gateway->getSecretKey());
0 ignored issues
show
Bug introduced by
It seems like setSecretKey() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

37
        $this->/** @scrutinizer ignore-call */ 
38
               setSecretKey($gateway->getSecretKey());
Loading history...
38
    }
39
}