Example #1
0
 protected function RunMainLoop()
 {
     if ($this->config->IsEmpty()) {
         throw new Exception('No configuration loaded.');
     }
     $this->console->Clear();
     $this->console->UseColor = $this->GetUseColorFromCli();
     $this->errorsOnly = $this->console->HasArg('m');
     $this->resolveIps = $this->console->HasArg('r');
     $this->interval = $this->GetIntervalFromCli();
     $this->monitors = $this->CreateMonitors();
     while ($this->enabled) {
         // check for file changes
         foreach ($this->monitors as $monitor) {
             if ($monitor->HasChanges()) {
                 $monitor->Display($this->console, $this->resolveIps, $this->errorsOnly);
             }
         }
         // did user decide to quit?
         /*if (non_block_read() == 'q') {
                    exit();
         		}*/
         // give the cpu some time to breath
         usleep($this->interval);
     }
 }