Test Failed
Pull Request — master (#125)
by Dmitriy
02:48
created

Command   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 15
c 1
b 0
f 0
dl 0
loc 47
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getResultFilePath() 0 3 1
A getPrompt() 0 3 1
A __construct() 0 10 1
A getHints() 0 5 1
A getAttributeLabels() 0 6 1
A getAttributes() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Gii\Generator\Gemini;
6
7
use Yiisoft\Validator\Rule\Required;
8
use Yiisoft\Yii\Gii\Generator\AbstractGeneratorCommand;
9
use Yiisoft\Yii\Gii\Validator\TemplateRule;
10
11
final class Command extends AbstractGeneratorCommand
12
{
13
    public function __construct(
14
        #[Required]
15
        private readonly string $prompt = 'Hello',
16
        #[Required]
17
        private readonly string $resultFilePath = 'src/gemini.txt',
18
        #[Required(message: 'A code template must be selected.')]
19
        #[TemplateRule]
20
        protected string $template = 'default',
21
    ) {
22
        parent::__construct($template);
23
    }
24
25
    public function getResultFilePath(): string
26
    {
27
        return $this->resultFilePath;
28
    }
29
30
    public function getPrompt(): string
31
    {
32
        return $this->prompt;
33
    }
34
35
    public static function getAttributeLabels(): array
36
    {
37
        return [
38
            'resultFilePath' => 'Model namespace',
39
            'prompt' => 'Text prompt',
40
            'template' => 'Template',
41
        ];
42
    }
43
44
    public static function getHints(): array
45
    {
46
        return [
47
            'resultFilePath' => 'Namespace for the model class to store it in the related directory.',
48
            'prompt' => 'Text to ask.',
49
        ];
50
    }
51
52
    public static function getAttributes(): array
53
    {
54
        return [
55
            'prompt',
56
            'resultFilePath',
57
            'template',
58
        ];
59
    }
60
}
61