Issues (33)

src/Gateway.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace ByTIC\Payments\Mobilpay;
4
5
use ByTIC\Omnipay\Mobilpay\Gateway as AbstractGateway;
6
use ByTIC\Payments\Gateways\Providers\AbstractGateway\Traits\GatewayTrait;
7
use ByTIC\Payments\Gateways\Providers\AbstractGateway\Traits\OverwriteServerCompletePurchaseTrait;
8
use ByTIC\Payments\Mobilpay\FileLoader\HasFileLoader;
9
use Omnipay\Common\Message\RequestInterface;
10
11
/**
12
 * Class Gateway
13
 * @package ByTIC\Payments\Mobilpay
14
 * @method \Omnipay\Common\Message\NotificationInterface acceptNotification(array $options = array())
15
 * @method \Omnipay\Common\Message\RequestInterface fetchTransaction(array $options = [])
16
 */
17
class Gateway extends AbstractGateway
18
{
19
    use GatewayTrait;
20
    use OverwriteServerCompletePurchaseTrait;
21
    use HasFileLoader;
22
23
    // ------------ REQUESTS ------------ //
24
    /**
25
     * @param array $parameters
26
     * @return RequestInterface|null
27
     */
28
    public function doPayT(array $parameters = []): RequestInterface
29
    {
30
        return $this->createRequestWithInternalCheck('Soap\Payment\DoPayTRequest', $parameters);
31
    }
32
33
    /**
34
     * @inheritDoc
35
     */
36
    public function setSandbox($value)
37
    {
38
        return $this->setTestMode($value == 'yes');
39
    }
40
41
    /**
42
     * @inheritDoc
43
     */
44
    public function getSandbox()
45
    {
46
        return $this->getTestMode() === true ? 'yes' : 'no';
47
    }
48
49
    /**
50
     * @return bool
51
     */
52
    public function isActive()
53
    {
54
        if (strlen($this->getCertificate()) >= 5 && strlen($this->getPrivateKey()) > 10) {
0 ignored issues
show
It seems like $this->getCertificate() can also be of type null; however, parameter $string of strlen() does only seem to accept string, 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

54
        if (strlen(/** @scrutinizer ignore-type */ $this->getCertificate()) >= 5 && strlen($this->getPrivateKey()) > 10) {
Loading history...
55
            return true;
56
        }
57
58
        return false;
59
    }
60
61
}
62