ChangeUrl::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 9
rs 10
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