src/Filesystem.php
/**
     * Applies the user-defined callback function to each line of a file.
     * This is inspired by array_walk (http://php.net/manual/en/function.array-walk.php)
     * @param string $filepath - path to the file to open and loop over.
     * @param \callable $callback - callback to execute on every line in the file.
     * @throws \Exception
     */
Applies the user-defined callback function to each line of a file.
This is inspired by array_walk
@param string $filepath - path to the file to open and loop over.
@param \callable $callback - callback to execute on every line in the file.
@throws \Exception
Applies the user - defined callback function to each line of a file . This is inspired by array_walk @param string $filepath - path to the file to open and loop over . @param \ callable $callback - callback to execute on every line in the file . @throws \ Exception
public static function fileWalk($filepath, callable $callback)
    {
        $handle = fopen($filepath, "r");
        if ($handle) 
        {
            while (($line = fgets($handle)) !== false) 
            {
                $callback($line);
            }
            fclose($handle);
        } 
        else 
        {
            throw new \Exception("fileWalk: Could not open file: " . $filepath);
        }
    }
public static function fileWalk ( $ filepath , callable $ callback ) { $ handle = fopen ( $ filepath , " r " ) ; if ( $ handle ) { while ( ( $ line = fgets ( $ handle ) ) !== false ) { $ callback ( $ line ) ; } fclose ( $ handle ) ; } else { throw new \ Exception ( " fileWalk: Could not open file:  " . $ filepath ) ; } }
Applies the user-defined callback function to each line of a file.
Applies the user - defined callback function to each line of a file .