UpdateCustomerProfileRequest::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 3
dl 0
loc 7
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php
2
3
namespace CommerceGuys\AuthNet;
4
5
use GuzzleHttp\Client;
6
use CommerceGuys\AuthNet\DataTypes\Profile;
7
use CommerceGuys\AuthNet\Request\RequestInterface;
8
9
/**
10
 * Update an existing customer profile.
11
 *
12
 * @link http://developer.authorize.net/api/reference/index.html#customer-profiles-update-customer-profile
13
 */
14
class UpdateCustomerProfileRequest extends BaseApiRequest
15
{
16
    protected $profile;
17
18
    public function __construct(
19
        Configuration $configuration,
20
        Client $client,
21
        Profile $profile = null
22
    ) {
23
        parent::__construct($configuration, $client);
24
        $this->profile = $profile;
25
    }
26
27
    protected function attachData(RequestInterface $request)
28
    {
29
        $request->addDataType($this->profile);
0 ignored issues
show
Bug introduced by
It seems like $this->profile 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

29
        $request->addDataType(/** @scrutinizer ignore-type */ $this->profile);
Loading history...
30
    }
31
}
32