DecryptPaymentDataRequest::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 5
dl 0
loc 11
ccs 0
cts 5
cp 0
crap 2
rs 10
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