Completed
Push — master ( 4a584e...bcb0a1 )
by Andrii
08:31
created

AbstractResponse   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 25%

Importance

Changes 5
Bugs 1 Features 0
Metric Value
wmc 4
c 5
b 1
f 0
lcom 0
cbo 0
dl 0
loc 52
ccs 2
cts 8
cp 0.25
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
redirect() 0 1 ?
isRedirect() 0 1 ?
isSuccessful() 0 1 ?
getWorker() 0 1 ?
A __call() 0 8 2
A getFee() 0 4 1
A getTime() 0 4 1
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-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hiqdev\php\merchant;
13
14
/**
15
 * Abstract Response class.
16
 */
17
abstract class AbstractResponse implements ResponseInterface
18
{
19
    /**
20
     * @var ResponseInterface
21
     */
22
    public $merchant;
23
24
    /**
25
     * @var RequestInterface
26
     */
27
    public $request;
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    abstract public function redirect();
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    abstract public function isRedirect();
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    abstract public function isSuccessful();
43
44
    /**
45
     * The instance of payment processing library.
46
     * @return \Omnipay\Common\Message\AbstractResponse|\Payum\Core\Model\Response
47
     */
48
    abstract public function getWorker();
49
50
    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...
51
    {
52
        if (method_exists($this->getWorker(), $name)) {
53
            return call_user_func_array([$this->getWorker(), $name], $args);
54
        }
55
56
        return null;
57
    }
58
59 1
    public function getFee()
60
    {
61 1
        return 0;
62
    }
63
64
    public function getTime()
65
    {
66
        return date('c');
67
    }
68
}
69