TextCaptcha   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Test Coverage

Coverage 84.62%

Importance

Changes 0
Metric Value
wmc 5
dl 0
loc 60
c 0
b 0
f 0
ccs 11
cts 13
cp 0.8462
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUuid() 0 3 1
A getUuid() 0 3 1
A __construct() 0 5 1
A getQuestion() 0 3 1
A getAnswer() 0 3 1
1
<?php
2
3
namespace Didatus\TextCaptcha;
4
5
use Ramsey\Uuid\Uuid;
6
7
/**
8
 * Class TextCaptcha
9
 * @package Didatus\TextCaptcha
10
 */
11
class TextCaptcha {
12
13
    /**
14
     * @var string
15
     */
16
    private $question;
17
18
    /**
19
     * @var string
20
     */
21
    private $answer;
22
23
    /**
24
     * @var string
25
     */
26
    private $uuid;
27
28
    /**
29
     * TextCaptcha constructor.
30
     *
31
     * @param string $question
32
     * @param string $answer
33
     */
34 8
    public function __construct(string $question, string $answer)
35
    {
36 8
        $this->question = $question;
37 8
        $this->answer = $answer;
38 8
        $this->uuid = Uuid::uuid1()->toString();
39 8
    }
40
41
    /**
42
     * @return string
43
     */
44 6
    public function getQuestion(): string
45
    {
46 6
        return $this->question;
47
    }
48
49
    /**
50
     * @return string
51
     */
52 6
    public function getAnswer(): string
53
    {
54 6
        return $this->answer;
55
    }
56
57
    /**
58
     * @return string
59
     */
60 1
    public function getUuid(): string
61
    {
62 1
        return $this->uuid;
63
    }
64
65
    /**
66
     * @param string $uuid
67
     */
68
    public function setUuid(string $uuid): void
69
    {
70
        $this->uuid = $uuid;
71
    }
72
73
74
}
75