Redirect::init()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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