Completed
Pull Request — master (#13)
by
unknown
16:15 queued 12:45
created

PurchaseRequest::setLanguage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Omnipay\Paysera\Message;
4
5
use Omnipay\Paysera\Common\Purchase;
6
use Omnipay\Paysera\Common\Signature;
7
8
class PurchaseRequest extends AbstractRequest
9
{
10
    /**
11
     * {@inheritdoc}
12
     * @throws \Omnipay\Common\Exception\InvalidRequestException
13
     */
14 5
    public function getData()
15
    {
16 5
        $this->validate('projectId', 'password');
17
18
        return [
19 5
            'data' => $data = Purchase::generate($this),
20 2
            'sign' => Signature::generate($data, $this->getPassword()),
21
        ];
22
    }
23
24
    /**
25
     * {@inheritdoc}
26
     */
27 1
    public function sendData($data)
28
    {
29 1
        $this->response = new PurchaseResponse($this, $data);
30
31 1
        return $this->response;
32
    }
33
34
    /**
35
     * Get the API version.
36
     *
37
     * @return string
38
     */
39 6
    public function getVersion()
40
    {
41 6
        return $this->getParameter('version');
42
    }
43
44
    /**
45
     * Set the API version.
46
     *
47
     * @param  string  $value
48
     * @return $this
49
     */
50 3
    public function setVersion($value)
51
    {
52 3
        return $this->setParameter('version', $value);
53
    }
54
55
    /**
56
     * Get the language.
57
     *
58
     * @return string
59
     */
60 5
    public function getLanguage()
61
    {
62 5
        return $this->getParameter('language');
63
    }
64
65
    /**
66
     * Set the language.
67
     *
68
     * @param  string  $value
69
     * @return $this
70
     */
71 4
    public function setLanguage($value)
72
    {
73 4
        return $this->setParameter('language', $value);
74
    }
75
}
76