diff options
Diffstat (limited to 'src/Captcha.php')
| -rw-r--r-- | src/Captcha.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Captcha.php b/src/Captcha.php index f60031a..a0c7a54 100644 --- a/src/Captcha.php +++ b/src/Captcha.php | |||
| @@ -10,12 +10,10 @@ class Captcha | |||
| 10 | { | 10 | { |
| 11 | private int $a; | 11 | private int $a; |
| 12 | private int $b; | 12 | private int $b; |
| 13 | private int $solution; | ||
| 14 | 13 | ||
| 15 | public function __construct(){ | 14 | public function __construct(){ |
| 16 | $this->a = rand(2, 9); | 15 | $this->a = rand(2, 9); |
| 17 | $this->b = rand(2, 9); | 16 | $this->b = rand(2, 9); |
| 18 | $this->solution = $this->a * $this->b; | ||
| 19 | } | 17 | } |
| 20 | 18 | ||
| 21 | public function getA(): string | 19 | public function getA(): string |
| @@ -28,7 +26,7 @@ class Captcha | |||
| 28 | } | 26 | } |
| 29 | public function getSolution(): int | 27 | public function getSolution(): int |
| 30 | { | 28 | { |
| 31 | return $this->solution; | 29 | return ($this->a * $this->b); |
| 32 | } | 30 | } |
| 33 | 31 | ||
| 34 | private function toLettersFrench(int $number): string | 32 | private function toLettersFrench(int $number): string |
| @@ -45,6 +43,8 @@ class Captcha | |||
| 45 | default => '', // erreur | 43 | default => '', // erreur |
| 46 | }; | 44 | }; |
| 47 | } | 45 | } |
| 46 | |||
| 47 | // (à déplacer dans FormValidation?) | ||
| 48 | static public function controlInput(string $input = '0'): int | 48 | static public function controlInput(string $input = '0'): int |
| 49 | { | 49 | { |
| 50 | // un POST est une chaîne qu'on doit convertir en nombre dans deux conditions: | 50 | // un POST est une chaîne qu'on doit convertir en nombre dans deux conditions: |
