Completed
Push — master ( 98d687...92b683 )
by Andrii
03:05
created

src/Message/PurchaseRequest.php (3 issues)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * RoboKassa driver for Omnipay PHP payment library
4
 *
5
 * @link      https://github.com/hiqdev/omnipay-robokassa
6
 * @package   omnipay-robokassa
7
 * @license   MIT
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace Omnipay\RoboKassa\Message;
12
13
class PurchaseRequest extends AbstractRequest
14
{
15
    public function getCurrency()
16
    {
17
        return $this->getParameter('currency');
18
    }
19
20
    public function setCurrency($value)
21
    {
22
        return $this->setParameter('currency', $value);
23
    }
24
25
    public function getLanguage()
26
    {
27
        return $this->getParameter('language');
28
    }
29
30
    public function setLanguage($value)
31
    {
32
        return $this->setParameter('language', $value);
33
    }
34
35
    public function getSignatureValue()
36
    {
37
        return $this->getParameter('signature');
38
    }
39
40
    public function setSignatureValue($value)
41
    {
42
        return $this->setParameter('signature', $value);
43
    }
44
45
    public function getData()
46
    {
47
        $this->validate(
48
            'purse',
49
            'amount', 'currency', 'description',
50
            'returnUrl', 'cancelUrl', 'notifyUrl'
51
        );
52
53
        return [
54
            'Desc' => $this->getDescription(),
55
            'MrchLogin' => $this->getPurse(),
56
            'OutSum' => $this->getAmount(),
57
            'IncCurrLabel' => $this->getCurrency(),
58
            'Culture' => $this->getLanguage(),
59
            'ShpCart' => $this->is_cart,
0 ignored issues
show
The property is_cart does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
60
            'ShpClient' => $this->client,
0 ignored issues
show
The property client does not seem to exist. Did you mean httpClient?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
61
            'ShpTime' => $this->time,
0 ignored issues
show
The property time does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
62
            'SignatureValue' => $this->getSignatureValue(),
63
        ];
64
    }
65
66
    public function sendData($data)
67
    {
68
        return $this->response = new PurchaseResponse($this, $data);
69
    }
70
}
71