CompletePurchaseRequestTrait::parseNotification()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

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 8
ccs 0
cts 5
cp 0
crap 6
rs 10
1
<?php
2
3
namespace ByTIC\Payments\Mobilpay\Message\Traits;
4
5
use ByTIC\Payments\Gateways\Providers\AbstractGateway\Message\Traits\HasGatewayRequestTrait;
6
use ByTIC\Payments\Gateways\Providers\AbstractGateway\Message\Traits\HasModelRequest;
7
use ByTIC\Payments\Mobilpay\Gateway;
8
9
/**
10
 * Trait CompletePurchaseRequestTrait
11
 * @package ByTIC\Payments\Mobilpay\Message\Traits
12
 */
13
trait CompletePurchaseRequestTrait
14
{
15
    use HasGatewayRequestTrait;
16
    use HasModelRequest;
17
18
19
    /**
20
     * @return bool|mixed
21
     * @throws \Exception
22
     */
23
    protected function parseNotification()
24
    {
25
        if ($this->validateModel()) {
26
            $model = $this->getModel();
27
            $this->updateParametersFromPurchase($model);
28
        }
29
30
        return parent::parseNotification();
31
    }
32
33
    /**
34
     * @param Gateway $modelGateway
35
     */
36
    protected function updateParametersFromGateway($modelGateway)
37
    {
38
        $this->setSignature($modelGateway->getSignature());
0 ignored issues
show
Bug introduced by
It seems like setSignature() 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

38
        $this->/** @scrutinizer ignore-call */ 
39
               setSignature($modelGateway->getSignature());
Loading history...
39
        $this->setCertificate($modelGateway->getCertificate());
0 ignored issues
show
Bug introduced by
It seems like setCertificate() 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

39
        $this->/** @scrutinizer ignore-call */ 
40
               setCertificate($modelGateway->getCertificate());
Loading history...
40
        $this->setPrivateKey($modelGateway->getPrivateKey());
0 ignored issues
show
Bug introduced by
It seems like setPrivateKey() 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

40
        $this->/** @scrutinizer ignore-call */ 
41
               setPrivateKey($modelGateway->getPrivateKey());
Loading history...
41
    }
42
}
43