ChangeUrl   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getIdentifier() 0 3 1
A __construct() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Everlution\Ajaxcom\Responder;
6
7
/**
8
 * Class ChangeUrl.
9
 *
10
 * @author Everlution s.r.o. <[email protected]>
11
 */
12
class ChangeUrl extends AbstractResponder
13
{
14
    const PUSH = 'push';
15
    const REPLACE = 'replace';
16
    const REDIRECT = 'redirect';
17
18
    private const OPTION_URL = 'url';
19
    private const OPTION_METHOD = 'method';
20
    private const OPTION_WAIT = 'wait';
21
22
    public function __construct(string $url, string $method, int $wait = 0)
23
    {
24
        $this->registerOption(self::OPTION_URL);
25
        $this->registerOption(self::OPTION_METHOD);
26
        $this->registerOption(self::OPTION_WAIT);
27
28
        $this->setOption(self::OPTION_URL, $url);
29
        $this->setOption(self::OPTION_METHOD, $method);
30
        $this->setOption(self::OPTION_WAIT, $wait);
31
    }
32
33
    protected function getIdentifier(): string
34
    {
35
        return 'changeurl';
36
    }
37
}
38