Passed
Push — master ( 07d70b...44bdf4 )
by Pablo
09:06
created

AbstractResponse   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 7
c 2
b 1
f 0
dl 0
loc 26
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getAuthorisationCode() 0 12 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Omnipay\Redsys\Message;
6
7
abstract class AbstractResponse extends \Omnipay\Common\Message\AbstractResponse
8
{
9
    /**
10
     * Helper method to get a specific response parameter if available.
11
     *
12
     * @param string $key The key to look up
13
     *
14
     * @return mixed|null
15
     */
16
    abstract protected function getKey($key);
17
18
    /**
19
     * @return string|null
20
     */
21
    protected function getAuthorisationCode()
22
    {
23
        $value = $this->getKey('Ds_AuthorisationCode');
24
25
        $value = str_replace('+', '', $value);
26
        $value = trim($value);
27
28
        if ('' === $value) {
29
            return null;
30
        }
31
32
        return $value;
33
    }
34
}
35