PhpOffice\PhpPresentation\Reader\PowerPoint2007::fileSupportsUnserializePhpPresentation PHP Method

fileSupportsUnserializePhpPresentation() public method

Does a file support UnserializePhpPresentation ?
public fileSupportsUnserializePhpPresentation ( string $pFilename = '' ) : boolean
$pFilename string
return boolean
    public function fileSupportsUnserializePhpPresentation($pFilename = '')
    {
        // Check if file exists
        if (!file_exists($pFilename)) {
            throw new \Exception("Could not open " . $pFilename . " for reading! File does not exist.");
        }
        $oZip = new ZipArchive();
        // Is it a zip ?
        if ($oZip->open($pFilename) === true) {
            // Is it an OpenXML Document ?
            // Is it a Presentation ?
            if (is_array($oZip->statName('[Content_Types].xml')) && is_array($oZip->statName('ppt/presentation.xml'))) {
                return true;
            }
        }
        return false;
    }

Usage Example

 /**
  * @expectedException \Exception
  * @expectedExceptionMessage Could not open  for reading! File does not exist.
  */
 public function testFileSupportsNotExists()
 {
     $object = new PowerPoint2007();
     $object->fileSupportsUnserializePhpPresentation('');
 }