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

CompletePurchaseRequestTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 26
ccs 7
cts 7
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getData() 0 9 2
A updateParametersFromGateway() 0 4 1
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
}