PurchaseResponse   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 12
c 1
b 0
f 1
dl 0
loc 31
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getRedirectUrl() 0 9 2
A getRedirectData() 0 8 1
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