Source of file RawContentReader.php

Size: 0,661 Bytes - Last Modified: 2021-12-23T10:29:05+00:00

/var/www/docs.ssmods.com/process/src/code/content/RawContentReader.php

12345678910111213141516171819202122232425262728293031323334353637383940
<?php

/**
 * Simple wrapper around raw content items
 * 
 * Use this if you're wanting to write some raw text, eg
 * 
 * $writer->write(new RawContentReader('raw text'));
 *
 * @author marcus@symbiote.com.au
 * @license BSD License http://silverstripe.org/bsd-license/
 */
class RawContentReader extends ContentReader {
	protected $raw;
	
	public function __construct($data) {
		// set a dummy for the id
		$this->id = 1;
		$this->raw = $data;
	}
	
	public function read() {
		return $this->raw;
	}
	
	/** 
	 * Never link to raw content 
	 *
	 * @return string
	 */
	public function getURL() {
		return '';
	}

	public function exists() {
		return true;
	}

}