From 90673ef19133e037cf401773f4262ba3d7d050bf Mon Sep 17 00:00:00 2001 From: polo Date: Sun, 3 Aug 2025 04:06:53 +0200 Subject: =?UTF-8?q?r=C3=A9organisation=204:=20d=C3=A9placement=20de=20fich?= =?UTF-8?q?iers,=20plus=20que=20des=20contr=C3=B4leurs=20dans=20/src/contr?= =?UTF-8?q?oller?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controller/Captcha.php | 52 ---------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 src/controller/Captcha.php (limited to 'src/controller/Captcha.php') diff --git a/src/controller/Captcha.php b/src/controller/Captcha.php deleted file mode 100644 index da61a53..0000000 --- a/src/controller/Captcha.php +++ /dev/null @@ -1,52 +0,0 @@ -a = rand(2, 9); - $this->b = rand(2, 9); - $this->solution = $this->a * $this->b; - } - - public function getA(): string - { - return $this->toLettersFrench($this->a); - } - public function getB(): string - { - return $this->toLettersFrench($this->b); - } - public function getSolution(): int - { - return $this->solution; - } - - private function toLettersFrench(int $number): string - { - return match($number){ - 2 => 'deux', - 3 => 'trois', - 4 => 'quatre', - 5 => 'cinq', - 6 => 'six', - 7 => 'sept', - 8 => 'huit', - 9 => 'neuf', - default => '', // erreur - }; - } - static public function controlInput(string $input = '0'): int - { - // un POST est une chaîne qu'on doit convertir en nombre dans deux conditions: - // test de format: $input est un nombre - // test d'intégrité: supprimer les décimales avec (int) ne change pas la valeur du nombre - return is_numeric($input) && $input == (int)$input ? (int)$input : 0; - } -} \ No newline at end of file -- cgit v1.2.3