<?php namespace JsonApi\Data;

class DataWrapper {

	/** @var mixed The actual data holder. **/
	private $data;

	private function validate($data) {
		if(!($data instanceof DataArray) && !($data instanceof DataItem)) {
			throw new \Exception('Supplied data must be instance of either DataItem or DataArray');
		}
	}

	public function write($data) { $this->validate($data); $this->data = $data; }
	public function read() { return $this->data; }

}
