canRead($docFile)) { $doc = new Document(); $doc->rtf = file_get_contents($docFile); $doc->read($phpWord); } else { throw new \Exception("Cannot read {$docFile}."); } return $phpWord; } }