PhpOffice\PhpPresentation\Reader\PowerPoint97::fileSupportsUnserializePhpPresentation PHP Метод

fileSupportsUnserializePhpPresentation() публичный Метод

Does a file support UnserializePhpPresentation ?
public fileSupportsUnserializePhpPresentation ( string $pFilename = '' ) : boolean
$pFilename string
Результат 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.");
        }
        try {
            // Use ParseXL for the hard work.
            $ole = new OLERead();
            // get excel data
            $ole->read($pFilename);
            return true;
        } catch (\Exception $e) {
            return false;
        }
    }

Usage Example

Пример #1
0
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage Could not open  for reading! File does not exist.
  */
 public function testFileSupportsNotExists()
 {
     $object = new PowerPoint97();
     $object->fileSupportsUnserializePhpPresentation('');
 }
PowerPoint97