src/HotReloader.php
/**
     * add an inotify watcher to all the files in a directory
     *
     * @param string $dir_path
     * @return void
     */
add an inotify watcher to all the files in a directory
@param string $dir_path
@return void
add an inotify watcher to all the files in a directory @param string $dir_path @return void
public function addWatcher(string $dir_path)
    {
        $rdi = new \RecursiveDirectoryIterator($dir_path);
        $rii = new \RecursiveIteratorIterator($rdi);
        foreach ($rii as $splFileInfo) {
            $file_name = $splFileInfo->getPathName();
            if ($file_name[0] === '.') {
                continue;
            }
            if (!$splFileInfo->isDir()) {
                if ($wd = \inotify_add_watch($this->fd, $file_name, IN_CREATE | IN_DELETE | IN_MODIFY | IN_MOVE)) {
                    $this->wds[] = $wd;
                }
            }
        }
    }
public function addWatcher ( string $ dir_path ) { $ rdi = new \ RecursiveDirectoryIterator ( $ dir_path ) ; $ rii = new \ RecursiveIteratorIterator ( $ rdi ) ; foreach ( $ rii as $ splFileInfo ) { $ file_name = $ splFileInfo -> getPathName ( ) ; if ( $ file_name [ 0 ] === '.' ) { continue ; } if ( ! $ splFileInfo -> isDir ( ) ) { if ( $ wd = \ inotify_add_watch ( $ this -> fd , $ file_name , IN_CREATE | IN_DELETE | IN_MODIFY | IN_MOVE ) ) { $ this -> wds [ ] = $ wd ; } } } }
add an inotify watcher to all the files in a directory
 @param string $dir_path
 @return void
add an inotify watcher to all the files in a directory @param string $dir_path @return void
// Skip hidden files and directories.