Passed
Push — main ( ed779b...d01439 )
by Nils
05:39 queued 02:41
created

Answer   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 31
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getAnswer() 0 3 1
A getCommand() 0 3 1
A getQuestion() 0 3 1
A __construct() 0 10 1
1
<?php
2
3
namespace Startwind\Forrest\Command\Answer;
4
5
use Startwind\Forrest\Command\Command;
6
use Startwind\Forrest\Command\CommandFactory;
7
8
class Answer
9
{
10
    private Command $command;
11
    private string $question;
12
    private string $answer;
13
14
    public function __construct(string $prompt, string $question, string $answer)
15
    {
16
        $this->command = CommandFactory::fromArray([
17
            CommandFactory::CONFIG_FIELD_NAME => 'forrest-ai',
18
            CommandFactory::CONFIG_FIELD_DESCRIPTION => 'Answer to: ' . $question,
19
            CommandFactory::CONFIG_FIELD_PROMPT => $prompt
20
        ]);
21
22
        $this->question = $question;
23
        $this->answer = $answer;
24
    }
25
26
    public function getCommand(): Command
27
    {
28
        return $this->command;
29
    }
30
31
    public function getQuestion(): string
32
    {
33
        return $this->question;
34
    }
35
36
    public function getAnswer(): string
37
    {
38
        return $this->answer;
39
    }
40
}
41