/** * Constructs the Iodophor\Io\FileReader class with given path to the file. By * default the file is opened in read (rb) mode. * * @param string $filename The path to the file. * @throws Iodophor\Io\Exception if the file cannot be read */ public function __construct($filename, $mode = null) { if ($mode === null) { $mode = 'rb'; } if (!file_exists($filename) || !is_readable($filename) || ($fd = fopen($filename, $mode)) === false) { throw new IoException('Unable to open file for reading: ' . $filename); } parent::__construct($fd); }