for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\Model;
/**
* An Experience API document.
* A document is immutable. This means that it can be accessed like an array.
* But you can only do this to read data. Thus an {@link UnsupportedOperationException}
* is thrown when you try to unset data or to manipulate them.
* @author Christian Flothmann <[email protected]>
abstract class Document implements \ArrayAccess
{
* @var DocumentData The document's data
private $data;
public function __construct(DocumentData $data)
$this->data = $data;
}
* {@inheritDoc}
public function offsetExists($offset)
return isset($this->data[$offset]);
public function offsetGet($offset)
return $this->data[$offset];
public function offsetSet($offset, $value)
$this->data[$offset] = $value;
public function offsetUnset($offset)
unset($this->data[$offset]);
* Returns the document's data.
* @return DocumentData The data
public function getData()
return $this->data;