private function register_watcher()
 {
     $watcher = $this;
     Route::get('/_watcher', function () use($watcher) {
         clearstatcache();
         $input = $watcher->cleanup(json_decode(Input::Get('query')));
         Event::fire('watcher:check', array($input));
         $response = array('do' => 'NOOP');
         if ($input !== null && $input->timestamp) {
             $timestamp = strtotime($input->timestamp);
             $viewBase = app_path() . '/views/';
             $controllerBase = app_path() . '/controllers/';
             $modelBase = app_path() . '/models/';
             $views = $watcher->check_modified($viewBase, $timestamp);
             $controllers = $watcher->check_modified($controllerBase, $timestamp);
             $models = $watcher->check_modified($modelBase, $timestamp);
             $otherDirs = array();
             if (isset($input->additionalfolders)) {
                 $additionalfolders = $input->additionalfolders;
                 if (is_array($additionalfolders)) {
                     foreach ($additionalfolders as $folder) {
                         $otherBase = base_path() . DS . $folder;
                         if (is_dir($otherBase)) {
                             $otherDirs += $watcher->check_modified($controllerBase, $timestamp);
                         }
                     }
                 }
             }
             if (count($views) > 0 || count($controllers) > 0 || count($models) > 0 || count($otherDirs) > 0) {
                 $response = array('do' => 'RELOAD');
             }
             if (isset($input->css)) {
                 foreach ($input->css as $cssFile) {
                     $file = public_path() . $cssFile;
                     if (file_exists($file) && filemtime($file) > $timestamp) {
                         $response = array('do' => 'RELOAD');
                     }
                 }
             }
             if (isset($input->js)) {
                 foreach ($input->js as $jsFile) {
                     $file = public_path() . $jsFile;
                     if (file_exists($file) && filemtime($file) > $timestamp) {
                         $response = array('do' => 'RELOAD');
                     }
                 }
             }
             if (filemtime($watcher->watcher_reload_file) > $timestamp) {
                 $response = array('do' => 'RELOAD');
             }
             return Response::json($response);
         }
         return Response::json($response);
     });
 }