PhpOffice\PhpPresentation\Shape\Drawing\ZipFile::getContents PHP Method

getContents() public method

public getContents ( ) : string
return string
    public function getContents()
    {
        if (!CommonFile::fileExists($this->getZipFileOut())) {
            throw new \Exception('File ' . $this->getZipFileOut() . ' does not exist');
        }
        $imageZip = new \ZipArchive();
        $imageZip->open($this->getZipFileOut());
        $imageContents = $imageZip->getFromName($this->getZipFileIn());
        $imageZip->close();
        unset($imageZip);
        return $imageContents;
    }

Usage Example

Esempio n. 1
0
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage fileNotExist.pptx does not exist
  */
 public function testContentsException()
 {
     $oDrawing = new ZipFile();
     $oDrawing->setPath($this->fileKoZip);
     $oDrawing->getContents();
 }