/** * Constructor. * * @param FilesystemObject|string $file File instance or the path of a file as a string of the file to read from. * The file or file path must be an existing file. * * @throws \Exception Throws an exception on error. */ public function __construct($file) { // Set the default file access mode $this->fileMode = FileAccessModeFactory::createReadOnlyMode(); // Get and store $file as File instance, throw an exception if failed if (($file = File::asFile($file)) === null) { // TODO: Throw a better exception! throw new \Exception("Invalid file!"); } // Set the file $this->setFile($file); }