-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7178 from Automattic/update/split-quiz-answer-model
Split the quiz answer model
- Loading branch information
Showing
20 changed files
with
363 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
includes/internal/quiz-submission/answer/models/class-answer-interface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
/** | ||
* File containing the Answer_Interface. | ||
* | ||
* @package sensei | ||
*/ | ||
|
||
namespace Sensei\Internal\Quiz_Submission\Answer\Models; | ||
|
||
use DateTimeInterface; | ||
|
||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
/** | ||
* Interface for the answer models. | ||
* | ||
* @internal | ||
* | ||
* @since $$next_version$$ | ||
*/ | ||
interface Answer_Interface { | ||
/** | ||
* Get the answer ID. | ||
* | ||
* @internal | ||
* | ||
* @return int | ||
*/ | ||
public function get_id(): int; | ||
|
||
/** | ||
* Get the submission ID. | ||
* | ||
* @internal | ||
* | ||
* @return int | ||
*/ | ||
public function get_submission_id(): int; | ||
|
||
/** | ||
* Get the question ID. | ||
* | ||
* @internal | ||
* | ||
* @return int | ||
*/ | ||
public function get_question_id(): int; | ||
|
||
/** | ||
* Get the answer value. | ||
* | ||
* @internal | ||
* | ||
* @return string | ||
*/ | ||
public function get_value(): string; | ||
|
||
/** | ||
* Get the created date. | ||
* | ||
* @internal | ||
* | ||
* @return DateTimeInterface | ||
*/ | ||
public function get_created_at(): DateTimeInterface; | ||
|
||
/** | ||
* Get the updated date. | ||
* | ||
* @internal | ||
* | ||
* @return DateTimeInterface | ||
*/ | ||
public function get_updated_at(): DateTimeInterface; | ||
} |
55 changes: 55 additions & 0 deletions
55
includes/internal/quiz-submission/answer/models/class-comments-based-answer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* File containing the Comments_Based_Answer class. | ||
* | ||
* @package sensei | ||
*/ | ||
|
||
namespace Sensei\Internal\Quiz_Submission\Answer\Models; | ||
|
||
use DateTimeInterface; | ||
|
||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
/** | ||
* Class Comments_Based_Answer. | ||
* | ||
* @internal | ||
* | ||
* @since $$next_version$$ | ||
*/ | ||
class Comments_Based_Answer extends Answer_Abstract { | ||
/** | ||
* Constructor. | ||
* | ||
* @internal | ||
* | ||
* @param int $submission_id The submission ID. | ||
* @param int $question_id The question ID. | ||
* @param string $value The answer value. | ||
* @param DateTimeInterface $created_at The created date. | ||
* @param DateTimeInterface $updated_at The updated date. | ||
*/ | ||
public function __construct( | ||
int $submission_id, | ||
int $question_id, | ||
string $value, | ||
DateTimeInterface $created_at, | ||
DateTimeInterface $updated_at | ||
) { | ||
parent::__construct( 0, $submission_id, $question_id, $value, $created_at, $updated_at ); | ||
} | ||
|
||
/** | ||
* Get the answer ID. | ||
* | ||
* @internal | ||
* | ||
* @throws \BadMethodCallException Comments_Based_Answer does not have an ID. | ||
*/ | ||
public function get_id(): int { | ||
throw new \BadMethodCallException( 'Comments_Based_Answer does not have an ID.' ); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
includes/internal/quiz-submission/answer/models/class-tables-based-answer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
/** | ||
* File containing the Tables_Based_Answer class. | ||
* | ||
* @package sensei | ||
*/ | ||
|
||
namespace Sensei\Internal\Quiz_Submission\Answer\Models; | ||
|
||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
/** | ||
* Class Tables_Based_Answer. | ||
* | ||
* @internal | ||
* | ||
* @since $$next_version$$ | ||
*/ | ||
class Tables_Based_Answer extends Answer_Abstract { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.