PhpOffice\PhpPresentation\Shape\Drawing\Base64::getExtension PHP Метод

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

public getExtension ( ) : string
Результат string
    public function getExtension()
    {
        list($data, ) = explode(';', $this->getData());
        list(, $mime) = explode(':', $data);
        if (!array_key_exists($mime, $this->arrayMimeExtension)) {
            throw new \Exception('Type Mime not found : "' . $mime . '"');
        }
        return $this->arrayMimeExtension[$mime];
    }

Usage Example

Пример #1
0
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage Type Mime not found : "fake/fake"
  */
 public function testExtensionException()
 {
     $imgData = str_replace('image/jpeg', 'fake/fake', $this->imageData);
     $oDrawing = new Base64();
     $oDrawing->setData($imgData);
     $oDrawing->getExtension();
 }