19 declare(strict_types=1);
49 if ($this->identification->serialize() !== $revision->
getIdentification()->serialize()) {
51 "Can't add Revision since it's not the same ResourceIdentification" 54 foreach ($this->revisions as
$r) {
58 "Can't add already existing version number: %s",
65 asort($this->revisions);
68 public function remove(
Revision $revision):
void 70 foreach ($this->revisions as $k => $revision_e) {
71 if ($revision->getVersionNumber() === $revision_e->getVersionNumber()) {
72 unset($this->revisions[$k]);
81 foreach ($this->revisions as $k => $revision_e) {
83 $this->revisions[$k] = $revision;
90 $this->revisions = [];
91 $this->
add($revision);
98 if (!$including_drafts) {
99 $v = array_filter($v,
static function (
Revision $revision):
bool {
100 return $revision->
getStatus() === RevisionStatus::PUBLISHED;
108 if (!$current instanceof
Revision) {
118 public function getAll(
bool $including_drafts): array
120 if($including_drafts) {
123 return array_filter($this->revisions,
static function (
Revision $revision):
bool {
124 return $revision->
getStatus() === RevisionStatus::PUBLISHED;
130 if ($this->revisions === []) {
133 return $this->
getCurrent($including_drafts)->getVersionNumber();
139 foreach ($this->revisions as $revision) {
140 $size += $revision->getInformation()->getSize();
replaceAllRevisions(Revision $revision)
replaceSingleRevision(Revision $revision)
getAll(bool $including_drafts)
ResourceIdentification $identification
__construct(ResourceIdentification $identification, array $revisions=[])
RevisionCollection constructor.
Class RevisionCollection.
Class ResourceIdentification.
getCurrent(bool $including_drafts)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
getMax(bool $including_drafts)