DecryptPaymentDataRequest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 11
c 2
b 1
f 0
dl 0
loc 24
ccs 0
cts 10
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A attachData() 0 5 1
1
<?php
2
3
namespace CommerceGuys\AuthNet;
4
5
use GuzzleHttp\Client;
6
use CommerceGuys\AuthNet\Request\RequestInterface;
7
use CommerceGuys\AuthNet\DataTypes\OpaqueData;
8
9
/**
10
 * Use this method to decrypt the VISA Checkout data.
11
 *
12
 * @link http://developer.authorize.net/api/reference/index.html#payment-transactions-charge-a-credit-card
13
 */
14
class DecryptPaymentDataRequest extends BaseApiRequest
15
{
16
    protected $opaqueData;
17
    protected $refId = '';
18
    protected $callId = '';
19
20
    public function __construct(
21
        Configuration $configuration,
22
        Client $client,
23
        OpaqueData $opaqueData = null,
24
        $refId,
25
        $callId
26
    ) {
27
          parent::__construct($configuration, $client);
28
          $this->opaqueData = $opaqueData;
29
          $this->refId = $refId;
30
          $this->callId = $callId;
31
    }
32
33
    protected function attachData(RequestInterface $request)
34
    {
35
        $request->addDataType($this->opaqueData);
0 ignored issues
show
Bug introduced by
It seems like $this->opaqueData can also be of type null; however, parameter $data of CommerceGuys\AuthNet\Req...nterface::addDataType() does only seem to accept CommerceGuys\AuthNet\DataTypes\DataTypeInterface, maybe add an additional type check? ( Ignorable by Annotation )

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

35
        $request->addDataType(/** @scrutinizer ignore-type */ $this->opaqueData);
Loading history...
36
        $request->addData('refId', $this->refId);
37
        $request->addData('callId', $this->callId);
38
    }
39
}
40