GeneratorRequest::getGenerator()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 1
c 2
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Gii\Request;
6
7
use Yiisoft\Input\Http\Attribute\Parameter\Body;
8
use Yiisoft\Input\Http\RequestInputInterface;
9
use Yiisoft\Router\HydratorAttribute\RouteArgument;
10
use Yiisoft\Yii\Gii\GeneratorInterface;
11
use Yiisoft\Yii\Gii\GiiInterface;
12
13
final class GeneratorRequest implements RequestInputInterface
14
{
15
    #[RouteArgument('generator')]
16
    private string $generatorId = '';
17
18
    #[Body('answers')]
19
    private array $answers = [];
20
21
    #[Body('parameters')]
22
    private array $parameters = [];
23
24
    public function __construct(private readonly GiiInterface $gii)
25
    {
26
    }
27
28
    public function getGenerator(): GeneratorInterface
29
    {
30
        return $this->gii->getGenerator($this->generatorId);
31
    }
32
33
    public function getAnswers(): array
34
    {
35
        return $this->answers;
36
    }
37
38
    public function getBody(): array
39
    {
40
        return $this->parameters;
41
    }
42
}
43