Пример #1
0
 /**
  * @return \ZipArchive
  *
  * @throws \Exception
  */
 private function getZip()
 {
     if (is_null($this->zipArchive)) {
         $this->tempFile = '/tmp/wordreader_' . microtime() . '.zip';
         $fp = fopen($this->tempFile, 'w');
         fwrite($fp, stream_get_contents($this->document->getObject()->first()->object));
         fclose($fp);
         $this->zipArchive = new \ZipArchive();
         if (!$this->zipArchive->open($this->tempFile)) {
             throw new \Exception('Failed to open archive');
         }
     }
     return $this->zipArchive;
 }