GeneratorRequest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 4
eloc 10
c 3
b 0
f 0
dl 0
loc 28
ccs 0
cts 8
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getGenerator() 0 3 1
A getAnswers() 0 3 1
A __construct() 0 2 1
A getBody() 0 3 1
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