From 9aaf91807315d546a7fecdf2708d0ed2135a3dac Mon Sep 17 00:00:00 2001 From: "maxime.rocher" Date: Tue, 21 Jan 2025 14:42:36 +0100 Subject: [PATCH] ajout commentaire sur les entity --- src/Entity/CharacterEntity.php | 20 +- src/Entity/CommentaryEntity.php | 6 +- src/Entity/FavoriteEntity.php | 17 +- src/Entity/ImageEntity.php | 33 +++- src/Entity/QuestionEntity.php | 309 ++++++++++++++++-------------- src/Entity/QuizEntity.php | 25 ++- src/Entity/QuizQuestionEntity.php | 30 +-- src/Entity/Quote.php | 16 ++ src/Entity/ResultsEntity.php | 88 ++++++--- src/Entity/SourceEntity.php | 39 +++- 10 files changed, 370 insertions(+), 213 deletions(-) diff --git a/src/Entity/CharacterEntity.php b/src/Entity/CharacterEntity.php index e43cafe..52e3436 100644 --- a/src/Entity/CharacterEntity.php +++ b/src/Entity/CharacterEntity.php @@ -3,14 +3,14 @@ namespace Entity; class CharacterEntity { - + // Properties private int $id_character; - private string $name; - private string $img_path; /** + * Constructor + * * @param int $id_character * @param string $name * @param string $img_path @@ -23,6 +23,8 @@ class CharacterEntity } /** + * Get the character ID + * * @return int */ public function getIdCharacter(): int @@ -31,6 +33,8 @@ class CharacterEntity } /** + * Set the character ID + * * @param int $id_character */ public function setIdCharacter(int $id_character): void @@ -39,6 +43,8 @@ class CharacterEntity } /** + * Get the character name + * * @return string */ public function getName(): string @@ -47,6 +53,8 @@ class CharacterEntity } /** + * Set the character name + * * @param string $name */ public function setName(string $name): void @@ -55,6 +63,8 @@ class CharacterEntity } /** + * Get the image path + * * @return string */ public function getImgPath(): string @@ -63,12 +73,12 @@ class CharacterEntity } /** + * Set the image path + * * @param string $img_path */ public function setImgPath(string $img_path): void { $this->img_path = $img_path; } - } - diff --git a/src/Entity/CommentaryEntity.php b/src/Entity/CommentaryEntity.php index b6f6528..76cb1a7 100644 --- a/src/Entity/CommentaryEntity.php +++ b/src/Entity/CommentaryEntity.php @@ -13,6 +13,8 @@ class CommentaryEntity { * @param int $id_comment * @param string $comment * @param string $date + * @param string $user + * @param string $img */ public function __construct(int $id_comment, string $comment, string $date, string $user, string $img) { @@ -82,7 +84,7 @@ class CommentaryEntity { /** * @param string $user */ - public function setUser(int $user): void + public function setUser(string $user): void { $this->user = $user; } @@ -98,7 +100,7 @@ class CommentaryEntity { /** * @param string $img */ - public function setImg(int $img): void + public function setImg(string $img): void { $this->img = $img; } diff --git a/src/Entity/FavoriteEntity.php b/src/Entity/FavoriteEntity.php index 987c548..98f20ae 100644 --- a/src/Entity/FavoriteEntity.php +++ b/src/Entity/FavoriteEntity.php @@ -3,10 +3,12 @@ namespace Entity; class FavoriteEntity { - private int $id_user; - private int $id_quote; + private int $id_user; // ID of the user + private int $id_quote; // ID of the quote /** + * Constructor to initialize the FavoriteEntity with user ID and quote ID + * * @param int $id_user * @param int $id_quote */ @@ -17,6 +19,8 @@ class FavoriteEntity } /** + * Get the user ID + * * @return int */ public function getIdUser(): int @@ -25,6 +29,8 @@ class FavoriteEntity } /** + * Set the user ID + * * @param int $id_user */ public function setIdUser(int $id_user): void @@ -33,6 +39,8 @@ class FavoriteEntity } /** + * Get the quote ID + * * @return int */ public function getIdQuote(): int @@ -41,13 +49,12 @@ class FavoriteEntity } /** + * Set the quote ID + * * @param int $id_quote */ public function setIdQuote(int $id_quote): void { $this->id_quote = $id_quote; } - - - } diff --git a/src/Entity/ImageEntity.php b/src/Entity/ImageEntity.php index 1b9ea56..f49548d 100644 --- a/src/Entity/ImageEntity.php +++ b/src/Entity/ImageEntity.php @@ -3,13 +3,14 @@ namespace Entity; class ImageEntity { - private int $idImg; - private string $imgPath; + private int $idImg; // ID of the image + private string $imgPath; // Path to the image file /** - * @param int $idImg - * @param string $imgPath - * @param string $isImgProfile + * Constructor for ImageEntity + * + * @param int $idImg ID of the image + * @param string $imgPath Path to the image file */ public function __construct(int $idImg, string $imgPath) { @@ -17,25 +18,43 @@ class ImageEntity $this->imgPath = $imgPath; } + /** + * Get the ID of the image + * + * @return int + */ public function getIdImg(): int { return $this->idImg; } + /** + * Set the ID of the image + * + * @param int $idImg + */ public function setIdImg(int $idImg): void { $this->idImg = $idImg; } + /** + * Get the path to the image file + * + * @return string + */ public function getImgPath(): string { return $this->imgPath; } + /** + * Set the path to the image file + * + * @param string $imgPath + */ public function setImgPath(string $imgPath): void { $this->imgPath = $imgPath; } - - } diff --git a/src/Entity/QuestionEntity.php b/src/Entity/QuestionEntity.php index c3cb082..e2aadd9 100644 --- a/src/Entity/QuestionEntity.php +++ b/src/Entity/QuestionEntity.php @@ -1,148 +1,175 @@ id_question = $id_question; + $this->question = $question; + $this->answerA = $answerA; + $this->answerB = $answerB; + $this->answerC = $answerC; + $this->answerD = $answerD; + $this->cAnswer = $cAnswer; + } + + /** + * Get the ID of the question. + * + * @return int The ID of the question. + */ + public function getIdQuestion(): int + { + return $this->id_question; + } + + /** + * Set the ID of the question. + * + * @param int $id_question The ID of the question. + */ + public function setIdQuestion(int $id_question): void + { + $this->id_question = $id_question; + } + + /** + * Get the question text. + * + * @return string The question text. + */ + public function getQuestion(): string + { + return $this->question; + } + + /** + * Set the question text. + * + * @param string $question The question text. + */ + public function setQuestion(string $question): void + { + $this->question = $question; + } + + /** + * Get the text for answer A. + * + * @return string The text for answer A. + */ + public function getAnswerA(): string + { + return $this->answerA; + } + + /** + * Set the text for answer A. + * + * @param string $answerA The text for answer A. + */ + public function setAnswerA(string $answerA): void + { + $this->answerA = $answerA; + } - class QuestionEntity + /** + * Get the text for answer B. + * + * @return string The text for answer B. + */ + public function getAnswerB(): string { - private int $id_question; - private string $question; - private string $answerA; - private string $answerB; - private string $answerC; - private string $answerD; - private string $cAnswer; - - /** - * @param int $id_question - * @param string $question - * @param string $answerA - * @param string $answerB - * @param string $answerC - * @param string $answerD - * @param string $cAnswer - */ - public function __construct(int $id_question, string $question, string $answerA, string $answerB, string $answerC, string $answerD, string $cAnswer) - { - $this->id_question = $id_question; - $this->question = $question; - $this->answerA = $answerA; - $this->answerB = $answerB; - $this->answerC = $answerC; - $this->answerD = $answerD; - $this->cAnswer = $cAnswer; - } - - /** - * @return int - */ - public function getIdQuestion(): int - { - return $this->id_question; - } - - /** - * @param int $id_question - */ - public function setIdQuestion(int $id_question): void - { - $this->id_question = $id_question; - } - - /** - * @return string - */ - public function getQuestion(): string - { - return $this->question; - } - - /** - * @param string $question - */ - public function setQuestion(string $question): void - { - $this->question = $question; - } - - /** - * @return string - */ - public function getAnswerA(): string - { - return $this->answerA; - } - - /** - * @param string $answerA - */ - public function setAnswerA(string $answerA): void - { - $this->answerA = $answerA; - } - - /** - * @return string - */ - public function getAnswerB(): string - { - return $this->answerB; - } - - /** - * @param string $answerB - */ - public function setAnswerB(string $answerB): void - { - $this->answerB = $answerB; - } - - /** - * @return string - */ - public function getAnswerC(): string - { - return $this->answerC; - } - - /** - * @param string $answerC - */ - public function setAnswerC(string $answerC): void - { - $this->answerC = $answerC; - } - - /** - * @return string - */ - public function getAnswerD(): string - { - return $this->answerD; - } - - /** - * @param string $answerD - */ - public function setAnswerD(string $answerD): void - { - $this->answerD = $answerD; - } - - /** - * @return string - */ - public function getCAnswer(): string - { - return $this->cAnswer; - } - - /** - * @param string $cAnswer - */ - public function setCAnswer(string $cAnswer): void - { - $this->cAnswer = $cAnswer; - } + return $this->answerB; + } + + /** + * Set the text for answer B. + * + * @param string $answerB The text for answer B. + */ + public function setAnswerB(string $answerB): void + { + $this->answerB = $answerB; + } + /** + * Get the text for answer C. + * + * @return string The text for answer C. + */ + public function getAnswerC(): string + { + return $this->answerC; + } + /** + * Set the text for answer C. + * + * @param string $answerC The text for answer C. + */ + public function setAnswerC(string $answerC): void + { + $this->answerC = $answerC; + } + /** + * Get the text for answer D. + * + * @return string The text for answer D. + */ + public function getAnswerD(): string + { + return $this->answerD; + } + + /** + * Set the text for answer D. + * + * @param string $answerD The text for answer D. + */ + public function setAnswerD(string $answerD): void + { + $this->answerD = $answerD; + } + + /** + * Get the correct answer. + * + * @return string The correct answer. + */ + public function getCAnswer(): string + { + return $this->cAnswer; + } + + /** + * Set the correct answer. + * + * @param string $cAnswer The correct answer. + */ + public function setCAnswer(string $cAnswer): void + { + $this->cAnswer = $cAnswer; } +} diff --git a/src/Entity/QuizEntity.php b/src/Entity/QuizEntity.php index e5f31da..e86d0cc 100644 --- a/src/Entity/QuizEntity.php +++ b/src/Entity/QuizEntity.php @@ -3,14 +3,15 @@ namespace Entity; class QuizEntity { - - private int $id_quiz; - - private int $nb_questions; + // Properties + private int $id_quiz; // ID of the quiz + private int $nb_questions; // Number of questions in the quiz /** - * @param int $id_quiz - * @param int $nb_questions + * Constructor + * + * @param int $id_quiz ID of the quiz + * @param int $nb_questions Number of questions in the quiz */ public function __construct(int $id_quiz, int $nb_questions) { @@ -19,6 +20,8 @@ class QuizEntity } /** + * Get the ID of the quiz + * * @return int */ public function getIdQuiz(): int @@ -27,6 +30,8 @@ class QuizEntity } /** + * Set the ID of the quiz + * * @param int $id_quiz */ public function setIdQuiz(int $id_quiz): void @@ -35,6 +40,8 @@ class QuizEntity } /** + * Get the number of questions in the quiz + * * @return int */ public function getNbQuestions(): int @@ -43,14 +50,12 @@ class QuizEntity } /** + * Set the number of questions in the quiz + * * @param int $nb_questions */ public function setNbQuestions(int $nb_questions): void { $this->nb_questions = $nb_questions; } - - - - } diff --git a/src/Entity/QuizQuestionEntity.php b/src/Entity/QuizQuestionEntity.php index ba7f898..469f97f 100644 --- a/src/Entity/QuizQuestionEntity.php +++ b/src/Entity/QuizQuestionEntity.php @@ -1,15 +1,16 @@ id_quiz = $id_quiz; } - - - } diff --git a/src/Entity/Quote.php b/src/Entity/Quote.php index f5eb1ab..9064d5c 100644 --- a/src/Entity/Quote.php +++ b/src/Entity/Quote.php @@ -3,13 +3,29 @@ class Quote{ + + // Represents the unique identifier for the quote private int $id; + + // The content of the quote private string $content; + + // The characteristic or attribute associated with the quote private string $carac; + + // The file path to the image associated with the quote private string $imgPath; + + // The title source of the quote private string $titleSrc; + + // The date source of the quote private string $dateSrc; + + // The number of likes the quote has received private int $like; + + // The language of the quote private string $langue; /** diff --git a/src/Entity/ResultsEntity.php b/src/Entity/ResultsEntity.php index e2b7938..b4dc106 100644 --- a/src/Entity/ResultsEntity.php +++ b/src/Entity/ResultsEntity.php @@ -3,67 +3,111 @@ namespace Entity; class ResultsEntity { + // Property to store the quiz ID private int $idQuiz; + // Property to store the user ID + private int $idUser; + + // Property to store the number of points + private int $nbPts; + + // Property to store the time + private int $time; + + /** + * Constructor to initialize the properties + * + * @param int $idQuiz The ID of the quiz + * @param int $idUser The ID of the user + * @param int $time The time taken + * @param int $nbPts The number of points + */ + public function __construct(int $idQuiz, int $idUser, int $time, int $nbPts) + { + $this->idQuiz = $idQuiz; + $this->idUser = $idUser; + $this->time = $time; + $this->nbPts = $nbPts; + } + + /** + * Get the user ID + * + * @return int The ID of the user + */ public function getIdUser(): int { return $this->idUser; } + /** + * Set the user ID + * + * @param int $idUser The ID of the user + */ public function setIdUser(int $idUser): void { $this->idUser = $idUser; } + /** + * Get the quiz ID + * + * @return int The ID of the quiz + */ public function getIdQuiz(): int { return $this->idQuiz; } + /** + * Set the quiz ID + * + * @param int $idQuiz The ID of the quiz + */ public function setIdQuiz(int $idQuiz): void { $this->idQuiz = $idQuiz; } + /** + * Get the time taken + * + * @return int The time taken + */ public function getTime(): int { return $this->time; } + /** + * Set the time taken + * + * @param int $time The time taken + */ public function setTime(int $time): void { $this->time = $time; } + /** + * Get the number of points + * + * @return int The number of points + */ public function getNbPts(): int { return $this->nbPts; } - public function setNbPts(int $nbPts): void - { - $this->nbPts = $nbPts; - } - - private int $idUser; - - private int $nbPts; - - private int $time; - /** - * @param int $idQuiz - * @param int $idUser - * @param int $time - * @param int $nbPts + * Set the number of points + * + * @param int $nbPts The number of points */ - public function __construct(int $idQuiz, int $idUser, int $time, int $nbPts) + public function setNbPts(int $nbPts): void { - $this -> idQuiz = $idQuiz; - $this -> idUser = $idUser; - $this -> time = $time; - $this -> nbPts = $nbPts; + $this->nbPts = $nbPts; } - - } diff --git a/src/Entity/SourceEntity.php b/src/Entity/SourceEntity.php index 48f6ea0..e600c2f 100644 --- a/src/Entity/SourceEntity.php +++ b/src/Entity/SourceEntity.php @@ -5,28 +5,33 @@ use Enum\TypeSourceEnum; class SourceEntity { - private int $id_source; + private int $id_source; // ID of the source - private string $title; + private string $title; // Title of the source - private string $date; + private string $date; // Date of the source - private TypeSourceEnum $type; + private TypeSourceEnum $type; // Type of the source /** + * Constructor to initialize the SourceEntity object + * * @param int $id_source * @param string $title * @param string $date + * @param TypeSourceEnum $type */ public function __construct(int $id_source, string $title, string $date, TypeSourceEnum $type) { $this->id_source = $id_source; $this->title = $title; $this->date = $date; - //$this->type = $type; + //$this->type = $type; // Uncomment this line to initialize the type } /** + * Get the ID of the source + * * @return int */ public function getIdSource(): int @@ -35,6 +40,8 @@ class SourceEntity } /** + * Set the ID of the source + * * @param int $id_source */ public function setIdSource(int $id_source): void @@ -43,6 +50,8 @@ class SourceEntity } /** + * Get the title of the source + * * @return string */ public function getTitle(): string @@ -51,6 +60,8 @@ class SourceEntity } /** + * Set the title of the source + * * @param string $title */ public function setTitle(string $title): void @@ -59,6 +70,8 @@ class SourceEntity } /** + * Get the date of the source + * * @return string */ public function getDate(): string @@ -67,6 +80,8 @@ class SourceEntity } /** + * Set the date of the source + * * @param string $date */ public function setDate(string $date): void @@ -74,17 +89,23 @@ class SourceEntity $this->date = $date; } - + /** + * Get the type of the source + * + * @return TypeSourceEnum + */ public function getType(): TypeSourceEnum { return $this->type; } - + /** + * Set the type of the source + * + * @param TypeSourceEnum $type + */ public function setType(TypeSourceEnum $type): void { $this->type = $type; } - - }