monitor = new MtimeMonitor(); //$this->monitor = new InotifyMonitor(); } else { $this->monitor = new MtimeMonitor(); } $this->scriptRunner = get_environment()->getScriptRunner(); } public function addRule(Rule $rule) { if ($rule->getInitialTrigger()) { $this->triggerRule($rule); } $this->rules[] = $rule; $this->monitor->add($rule); } private function triggerRule(Rule $rule) { $actions = $rule->getActions(); $this->scriptRunner->evaluate($actions); } public function loop() { $this->monitor->loop(); $modified = $this->monitor->getModified(); foreach ($modified as $rule) { $this->triggerRule($rule); } } }