Exemplo n.º 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);
     }
 }
Exemplo n.º 2
0
 protected function RunMainLoop()
 {
     $this->console->Clear();
     $this->errorsOnly = $this->console->HasArg('m');
     $this->resolveIps = $this->console->HasArg('r');
     $this->interval = ($this->console->HasArg('-delay') ? $this->console->GetArg('-delay', 100) : $this->console->GetArg('d', 100)) * 1000;
     $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);
     }
 }