public static function getContents($filename)
    {
        $file = fopen($filename, "r");

        if ($file === false) {
            throw new \RuntimeException("Cannot read the file: {$filename}");
        }

        $data = [];
        while ($row = fgetcsv($file)) {
            $data[] = $row;
        }

        fclose($file);

        return $data;
    }
public static function getContents($filename)
    {
        $file = fopen($filename, "r");

        if ($file === false) {
            throw new \RuntimeException("Cannot read the file: {$filename}");
        }

        $data = [];
        while ($row = fgetcsv($file)) {
            $data[] = $row;
        }

        fclose($file);

        return $data;
    }
public static function getContents ( $ filename ) { $ file = fopen ( $ filename , "r" ) ; if ( $ file === false ) { throw new \ RuntimeException ( "Cannot read the file: {$filename}" ) ; } $ data = [ ] ; while ( $ row = fgetcsv ( $ file ) ) { $ data [ ] = $ row ; } fclose ( $ file ) ; return $ data ; }
Read the contents of a csv file, and throw a RuntimeException if it cannot be done.

@param string $filename The path to the file

@return array The data read from the file
Read the contents of a csv file and throw a RuntimeException if it cannot be done .