isBinary() public method

True if the item is binary; false if it is not.
public isBinary ( ) : boolean
return boolean
Exemplo n.º 1
0
 private function convertItem(ItemInterface $item)
 {
     $path = $item->getPath(ItemInterface::SNAPSHOT_PATH_RELATIVE);
     if ($item->isBinary() === true) {
         $item->setPath($path, ItemInterface::SNAPSHOT_PATH_RELATIVE_AFTER_CONVERT);
         return;
     }
     $this->eventDispatcher->dispatch('spress.before_convert', new Event\ContentEvent($item, ItemInterface::SNAPSHOT_RAW, ItemInterface::SNAPSHOT_PATH_RELATIVE));
     $result = $this->converterManager->convertItem($item);
     $str = new StringWrapper($path);
     $filenameWithoutExtension = $str->deleteSufix($result->getInputExtension());
     $newPath = $filenameWithoutExtension . $result->getExtension();
     $item->setContent($result->getResult(), ItemInterface::SNAPSHOT_AFTER_CONVERT);
     $item->setPath($newPath, ItemInterface::SNAPSHOT_PATH_RELATIVE_AFTER_CONVERT);
     $this->eventDispatcher->dispatch('spress.after_convert', new Event\ContentEvent($item, ItemInterface::SNAPSHOT_AFTER_CONVERT, ItemInterface::SNAPSHOT_PATH_RELATIVE_AFTER_CONVERT));
 }