Completed
Push — master ( a60993...c4533a )
by Andrii
02:28
created

OmnipayResponse::getTime()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * Generalization over Omnipay and Payum
5
 *
6
 * @link      https://github.com/hiqdev/php-merchant
7
 * @package   php-merchant
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2015, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hiqdev\php\merchant;
13
14
/**
15
 * Omnipay Response class.
16
 */
17
class OmnipayResponse extends AbstractResponse
18
{
19
    /**
20
     * @var \Omnipay\Common\Message\ResponseInterface
21
     */
22
    protected $_worker;
23
24
    /**
25
     * @var OmnipayRequest Omnipay Request object
26
     */
27
    public $request;
28
29
    /**
30
     * @return \Omnipay\Common\Message\ResponseInterface
31
     */
32
    public function getWorker()
33
    {
34
        if ($this->_worker === null) {
35
            $this->_worker = $this->request->getWorker()->send();
36
        }
37
38
        return $this->_worker;
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function redirect()
45
    {
46
        $this->getWorker()->redirect();
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function isRedirect()
53
    {
54
        return $this->getWorker()->isRedirect();
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function isSuccessful()
61
    {
62
        return $this->getWorker()->isSuccessful();
63
    }
64
65
    public function __call($name, $args)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
66
    {
67
        if (method_exists($this->getWorker(), $name)) {
68
            return call_user_func_array([$this->getWorker(), $name], $args);
69
        }
70
71
        return null;
72
    }
73
74
    public function getVar($name)
75
    {
76
        return $this->getWorker()->getData()[$name];
77
    }
78
}
79