HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
FieldFactory.php
Go to the documentation of this file.
1 <?php
2 
11 {
15  private $fields = array();
16 
26  public function getField($position)
27  {
28  if (!isset($this->fields[$position])) {
29  switch ($position) {
30  case 0:
31  $this->fields[$position] = new MinutesField();
32  break;
33  case 1:
34  $this->fields[$position] = new HoursField();
35  break;
36  case 2:
37  $this->fields[$position] = new DayOfMonthField();
38  break;
39  case 3:
40  $this->fields[$position] = new MonthField();
41  break;
42  case 4:
43  $this->fields[$position] = new DayOfWeekField();
44  break;
45  case 5:
46  $this->fields[$position] = new YearField();
47  break;
48  default:
49  throw new InvalidArgumentException(
50  $position.' is not a valid position'
51  );
52  }
53  }
54 
55  return $this->fields[$position];
56  }
57 }