/** * Imports a resource from the given string content into this collection. * * On a successful import this method returns a PersistentResource object representing the newly * imported persistent resource. * * Note that this collection must have a writable storage in order to import resources. * * The specified filename will be used when presenting the resource to a user. Its file extension is * important because the resource management will derive the IANA Media Type from it. * * @param string $content The actual content to import * @return PersistentResource A resource object representing the imported resource * @throws ResourceException */ public function importResourceFromContent($content) { if (!$this->storage instanceof WritableStorageInterface) { throw new ResourceException(sprintf('Could not import resource into collection "%s" because its storage "%s" is a read-only storage.', $this->name, $this->storage->getName()), 1381155740); } return $this->storage->importResourceFromContent($content, $this->name); }