RedirectInlineAction::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 3.1406

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
ccs 3
cts 4
cp 0.75
rs 10
cc 3
nc 2
nop 1
crap 3.1406
1
<?php
2
3
4
namespace UserAdmin\IndexPage\Actions\InlineActions;
5
6
use UserAdmin\IndexPage\Actions\AbstractInlineAction;
7
8
class RedirectInlineAction extends AbstractInlineAction
9
{
10
    public ?string $redirectUrl = null;
11
12 1
    public function __construct(...$args)
13
    {
14 1
        parent::__construct(...$args);
15
16 1
        if (!empty($args[1]) && is_string($args[1])) {
17
            $this->redirectUrl = $args[1];
18
        }
19 1
    }
20
21
    /**
22
     * @inheritDoc
23
     */
24 1
    public function component(): string
25
    {
26 1
        return 'index-inline-action-redirect';
27
    }
28
29 1
    public function customGlobalData(): array
30
    {
31
        return [
32 1
            'url' => $this->redirectUrl,
33
        ];
34
    }
35
}
36