PurchaseResponse::getRedirectData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 4
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 8
rs 10
1
<?php
2
3
namespace ByTIC\Omnipay\PlatiOnline\Message;
4
5
use ByTIC\Omnipay\Common\Message\Traits\RedirectHtmlTrait;
6
use Omnipay\Common\Message\RedirectResponseInterface;
7
8
/**
9
 * Class PurchaseResponse
10
 * @package ByTIC\Omnipay\PlatiOnline\Message
11
 */
12
class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface
13
{
14
    use RedirectHtmlTrait {
15
        getRedirectUrl as getRedirectUrlTrait;
16
    }
17
18
    /**
19
     * @return array
20
     */
21
    public function getRedirectData()
22
    {
23
        $data = [
24
            'env_key' => $this->getDataProperty('env_key'),
25
            'data' => $this->getDataProperty('data'),
26
        ];
27
28
        return $data;
29
    }
30
31
    /**
32
     * @inheritDoc
33
     */
34
    public function getRedirectUrl()
35
    {
36
        $url = $this->getRedirectUrlTrait();
37
        $lang = $this->getDataProperty('lang', 'ro');
38
        if ($lang == 'en') {
39
            $url .= '/' . $lang;
40
        }
41
42
        return $url;
43
    }
44
}
45