Newer
Older
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
62
63
64
65
66
67
68
<?php defined('SYSPATH') or die('No direct script access.');
class Model_Helper_DisciplineBuilder extends Model
{
private $data;
public function create() {
if (count($this->data) != 8)
throw new ErrorException;
return new Model_Discipline($this->data, false);
}
function & author($id) {
if (!is_numeric($id) && $id <= 0)
throw new InvalidArgumentException();
$this->data['authorID'] = $id;
return $this;
}
function & grade($id) {
if (!is_numeric($id) && $id <= 0)
throw new InvalidArgumentException();
$this->data['gradeID'] = $id;
return $this;
}
function & faculty($id) {
if (!is_numeric($id) && $id <= 0)
throw new InvalidArgumentException();
$this->data['facultyID'] = $id;
return $this;
}
function & subject($id) {
if (!is_numeric($id) && $id <= 0)
throw new InvalidArgumentException();
$this->data['subjectID'] = $id;
return $this;
}
function & lectures($hours) {
if (!is_numeric($hours) && $hours < 0)
throw new InvalidArgumentException();
$this->data['lectures'] = $hours;
return $this;
}
function & practice($hours) {
if (!is_numeric($hours) && $hours < 0)
throw new InvalidArgumentException();
$this->data['practice'] = $hours;
return $this;
}
function & labs($hours) {
if (!is_numeric($hours) && $hours < 0)
throw new InvalidArgumentException();
$this->data['labs'] = $hours;
return $this;
}
function & type($name) {
if (!$name) // todo: enum
throw new InvalidArgumentException();
$this->data['type'] = $name;
return $this;
}
}