Passed
Pull Request — master (#58)
by Dmitriy
13:13 queued 10:22
created

ControllerRequest::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 2
ccs 0
cts 1
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Gii\Request;
6
7
use Yiisoft\RequestModel\RequestModel;
8
use Yiisoft\Yii\Gii\Generator\Controller\ControllerGenerator;
9
use Yiisoft\Yii\Gii\GeneratorInterface;
10
use Yiisoft\Yii\Gii\GiiInterface;
11
12
final class ControllerRequest extends RequestModel
13
{
14
    public function __construct(private GiiInterface $gii)
15
    {
16
    }
17
18
    public function getGenerator(): GeneratorInterface
19
    {
20
        /** @var ControllerGenerator $generator */
21
        return $this->gii->getGenerator(ControllerGenerator::getId());
22
    }
23
24
    public function getAnswers(): ?array
25
    {
26
        return $this->getAttributeValue('body.answers');
27
    }
28
}
29