Redirect   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 29
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 4 1
A initable() 0 6 1
A getLanguage() 0 4 1
1
<?php
2
3
namespace Loevgaard\AltaPay\Callback;
4
5
use Psr\Http\Message\ServerRequestInterface;
6
7
class Redirect extends Callback
8
{
9
    /**
10
     * ISO 639 alpha 2 language code
11
     *
12
     * @var string
13
     */
14
    protected $language;
15
16 6
    public function init()
17
    {
18 6
        $this->language = $this->body['language'];
19 6
    }
20
21 12
    public static function initable(ServerRequestInterface $request): bool
22
    {
23 12
        $body = static::getBodyFromRequest($request);
24
25 12
        return isset($body['language']);
26
    }
27
28
    /**
29
     * @return string
30
     */
31 3
    public function getLanguage(): string
32
    {
33 3
        return $this->language;
34
    }
35
}
36