Completed
Push — master ( 3e6656...a43425 )
by Andrii
10s
created

PurchaseRequest::setCurrency()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/*
4
 * RoboKassa driver for the Omnipay PHP payment processing library
5
 *
6
 * @link      https://github.com/hiqdev/omnipay-epayservice
7
 * @package   omnipay-epayservice
8
 * @license   MIT
9
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace Omnipay\RoboKassa\Message;
13
14
class PurchaseRequest extends AbstractRequest
15
{
16
    public function getCurrency()
17
    {
18
        return $this->getParameter('currency');
19
    }
20
21
    public function setCurrency($value)
22
    {
23
        return $this->setParameter('currency', $value);
24
    }
25
26
    public function getLanguage()
27
    {
28
        return $this->getParameter('language');
29
    }
30
31
    public function setLanguage($value)
32
    {
33
        return $this->setParameter('language', $value);
34
    }
35
36
    public function getSignatureValue()
37
    {
38
        return $this->getParameter('signature');
39
    }
40
41
    public function setSignatureValue($value)
42
    {
43
        return $this->setParameter('signature', $value);
44
    }
45
46
    public function getData()
47
    {
48
        $this->validate(
49
            'purse',
50
            'amount', 'currency', 'description',
51
            'returnUrl', 'cancelUrl', 'notifyUrl'
52
        );
53
54
        return [
55
            'Desc' => $this->getDescription(),
56
            'MrchLogin' => $this->getPurse(),
57
            'OutSum' => $this->getAmount(),
58
            'IncCurrLabel' => $this->getCurrency(),
59
            'Culture' => $this->getLanguage(),
60
            'ShpCart' => $this->is_cart,
0 ignored issues
show
Bug introduced by
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...
61
            'ShpClient' => $this->client,
0 ignored issues
show
Bug introduced by
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...
62
            'ShpTime' => $this->time,
0 ignored issues
show
Bug introduced by
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...
63
            'SignatureValue' => $this->getSignatureValue(),
64
        ];
65
    }
66
67
    public function sendData($data)
68
    {
69
        return $this->response = new PurchaseResponse($this, $data);
70
    }
71
}
72