readDataOnly; return true; } /** * Set read data only * * @param bool $pValue * @return \PhpOffice\PhpWord\Reader\IReader */ public function setReadDataOnly($pValue = true) { $this->readDataOnly = $pValue; return $this; } /** * Open file for reading * * @param string $pFilename * @return resource * @throws \PhpOffice\PhpWord\Exceptions\Exception */ protected function openFile($pFilename) { // Check if file exists if (!\file_exists($pFilename) || !is_readable($pFilename)) { throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); } // Open file $this->fileHandle = fopen($pFilename, 'r'); if ($this->fileHandle === false) { throw new Exception("Could not open file " . $pFilename . " for reading."); } } /** * Can the current IReader read the file? * * @param string $pFilename * @return bool */ public function canRead($pFilename) { // Check if file exists try { $this->openFile($pFilename); } catch (Exception $e) { return false; } fclose($this->fileHandle); return true; } }