| 1 | <?php |
||
| 12 | class Content { |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var string sha1 hash of the object content upon creation |
||
| 16 | */ |
||
| 17 | private $initialHash; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var mixed |
||
| 21 | */ |
||
| 22 | private $data; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var string|null |
||
| 26 | */ |
||
| 27 | private $model; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Should always be called AFTER overriding constructors so a hash can be created |
||
| 31 | * |
||
| 32 | * @param mixed $data |
||
| 33 | * @param string|null $model |
||
| 34 | */ |
||
| 35 | public function __construct( $data, $model = null ) { |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @return string |
||
| 43 | */ |
||
| 44 | public function getModel() { |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Returns a sha1 hash of the content |
||
| 50 | * |
||
| 51 | * @throws LogicException |
||
| 52 | * @return string |
||
| 53 | */ |
||
| 54 | public function getHash() { |
||
| 68 | |||
| 69 | /** |
||
| 70 | * Has the content been changed since object construction (this shouldn't happen!) |
||
| 71 | * |
||
| 72 | * @return bool |
||
| 73 | */ |
||
| 74 | public function hasChanged() { |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @return mixed |
||
| 80 | */ |
||
| 81 | public function getData() { |
||
| 84 | |||
| 85 | } |
||
| 86 |