CompletePurchaseRequestTrait   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 5
c 1
b 0
f 1
dl 0
loc 24
ccs 0
cts 9
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parseNotification() 0 9 2
A isValidNotification() 0 3 3
1
<?php
2
3
namespace ByTIC\Omnipay\Twispay\Message\Traits;
4
5
use ByTIC\Omnipay\Common\Message\Traits\GatewayNotificationRequestTrait;
6
use ByTIC\Omnipay\Twispay\Helper;
7
8
/**
9
 * Trait CompletePurchaseRequestTrait
10
 * @package ByTIC\Omnipay\Twispay\Message\Traits
11
 */
12
trait CompletePurchaseRequestTrait
13
{
14
    use GatewayNotificationRequestTrait;
15
16
    /**
17
     * @return bool|mixed
18
     */
19
    protected function parseNotification()
20
    {
21
        $dataResult = $this->hasPOST('opensslResult')
22
            ? $this->httpRequest->request->get('opensslResult')
23
            : $this->httpRequest->request->get('result');
24
25
        $json = Helper::decrypt($dataResult, $this->getApiKey());
0 ignored issues
show
Bug introduced by
It seems like getApiKey() 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

25
        $json = Helper::decrypt($dataResult, $this->/** @scrutinizer ignore-call */ getApiKey());
Loading history...
26
        $data = json_decode($json, true);
27
        return $data;
28
    }
29
30
    /**
31
     * @return mixed
32
     */
33
    protected function isValidNotification()
34
    {
35
        return $this->hasGet('id') && ($this->hasPOST('opensslResult') || $this->hasPOST('result'));
36
    }
37
}
38