This repository has been archived by the owner on Feb 27, 2021. It is now read-only.
/
Option.php
61 lines (52 loc) · 1.51 KB
/
Option.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
abstract class OptionType
{
const OtherAPI = "otherAPI";
const Image = "image";
const Text = "text";
const Color = "color";
// etc.
}
/**
* Created by Adrian Edwards on 8/25/2017 12:47 PM.
*/
class Option {
public $type;
public $content;
public $correct;
/**
* Question constructor.
* @param $type
* @param $content
* @param $correct
*/
public function __construct($type, $content, $correct = null) {
$this->type = $type;
$this->content = $content;
$this->correct = $correct;
}
/** Returns the stored content set in the constructor
* @return string
*/
public function getContent(){return $this->content;}
/** Returns a new Option() object that holds the same data as the current one. {@see getDesiredNumberOfChoices}
* @return Option
*/
public function duplicate() {return new Option($this->type, $this->content, $this->correct);}
/** Returns the option type
* @return string
*/
public function getType(){return $this->type;}
/** Sets the Option type in the few cases where it needs changing (if it even does, I dont remember if this is used)
* @param mixed $type
*/
public function setType($type){$this->type = $type;}
/** Returns true if this option was set as the correct one, false otherwise. (this is for an unimplemented feature)
* @return boolean
*/
public function isCorrect()
{
if (is_null($this->correct)) {return false;}
else {return $this->correct;}
}
}