ILIAS  release_7 Revision v7.30-3-g800a261c036
GetRevisionTrait.php
Go to the documentation of this file.
1<?php
2
4
6use OutOfBoundsException;
7
12trait GetRevisionTrait
13{
18 protected function getRevision() : Revision
19 {
20 if ($this->revision_number !== null) {
21 if ($this->resource->hasSpecificRevision($this->revision_number)) {
22 $revision = $this->resource->getSpecificRevision($this->revision_number);
23 } else {
24 throw new OutOfBoundsException("there is no version $this->revision_number of resource {$this->resource->getIdentification()->serialize()}");
25 }
26 } else {
27 $revision = $this->resource->getCurrentRevision();
28 }
29 return $revision;
30 }
31
32}
An exception for terminatinating execution or to throw for unit testing.