-
Notifications
You must be signed in to change notification settings - Fork 0
/
encuesta.php
59 lines (47 loc) · 1.03 KB
/
encuesta.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
<?php
class Encuesta {
private $a_preguntas;
public function __construct()
{
$a_preguntas=array(null);
}
public function addP($obj, $key = null) {
if ($key == null) {
$this->a_preguntas[] = $obj;
}
else {
if (isset($this->a_preguntas[$key])) {
throw new KeyHasUseException("Key $key en uso.");
}
else {
$this->a_preguntas[$key] = $obj;
}
}
}
public function delP($key) {
if (isset($this->a_preguntas[$key])) {
unset($this->a_preguntas[$key]);
}
else {
throw new KeyInvalidException("key invalida -> $key.");
}
}
public function getP($key) {
if (isset($this->a_preguntas[$key])) {
return $this->a_preguntas[$key];
}
else {
throw new KeyInvalidException("key invalida -> $key.");
}
}
public function keys() {
return array_keys($this->a_preguntas);
}
public function tam() {
return count($this->a_preguntas);
}
public function existeKey($key) {
return isset($this->a_preguntas[$key]);
}
}
?>