HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
HoursField.php
Go to the documentation of this file.
1 <?php
2 
8 class HoursField extends AbstractField
9 {
13  public function isSatisfiedBy(DateTime $date, $value)
14  {
15  return $this->isSatisfied($date->format('H'), $value);
16  }
17 
21  public function increment(DateTime $date, $invert = false)
22  {
23  if ($invert) {
24  $date->sub(new DateInterval('PT1H'));
25  $date->setTime($date->format('H'), 59, 0);
26  } else {
27  $date->add(new DateInterval('PT1H'));
28  $date->setTime($date->format('H'), 0, 0);
29  }
30 
31  return $this;
32  }
33 
37  public function validate($value)
38  {
39  return (bool) preg_match('/[\*,\/\-0-9]+/', $value);
40  }
41 }