Issues (5)

src/CreateTransactionRequest.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace CommerceGuys\AuthNet;
4
5
use GuzzleHttp\Client;
6
use CommerceGuys\AuthNet\DataTypes\TransactionRequest;
7
use CommerceGuys\AuthNet\Request\RequestInterface;
8
9
/**
10
 * Use this method to authorize and capture a credit card payment.
11
 *
12
 * @link http://developer.authorize.net/api/reference/index.html#payment-transactions-charge-a-credit-card
13
 */
14
class CreateTransactionRequest extends BaseApiRequest
15
{
16
    protected $transactionRequest;
17
18 9
    public function __construct(
19
        Configuration $configuration,
20
        Client $client,
21
        TransactionRequest $transactionRequest = null
22
    ) {
23 9
        parent::__construct($configuration, $client);
24 9
        $this->transactionRequest = $transactionRequest;
25 9
    }
26
27
    /**
28
     * @param \CommerceGuys\AuthNet\DataTypes\TransactionRequest $transactionRequest
29
     * @return $this
30
     */
31 8
    public function setTransactionRequest($transactionRequest)
32
    {
33 8
        $this->transactionRequest = $transactionRequest;
34 8
        return $this;
35
    }
36
37 8
    protected function attachData(RequestInterface $request)
38
    {
39 8
        $request->addDataType($this->transactionRequest);
0 ignored issues
show
It seems like $this->transactionRequest 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

39
        $request->addDataType(/** @scrutinizer ignore-type */ $this->transactionRequest);
Loading history...
40 8
    }
41
}
42