19 declare(strict_types=1);
41 if ($this->identification->serialize() !== $revision->
getIdentification()->serialize()) {
43 "Can't add Revision since it's not the same ResourceIdentification" 46 foreach ($this->revisions as
$r) {
50 "Can't add already existing version number: %s",
57 asort($this->revisions);
60 public function remove(
Revision $revision):
void 62 foreach ($this->revisions as $k => $revision_e) {
63 if ($revision->getVersionNumber() === $revision_e->getVersionNumber()) {
64 unset($this->revisions[$k]);
73 foreach ($this->revisions as $k => $revision_e) {
75 $this->revisions[$k] = $revision;
82 $this->revisions = [];
83 $this->
add($revision);
88 $v = $this->revisions;
90 if (!$including_drafts) {
91 $v = array_filter($v,
static fn(
Revision $revision):
bool => $revision->
getStatus() === RevisionStatus::PUBLISHED);
106 public function getAll(
bool $including_drafts): array
108 if ($including_drafts) {
109 return $this->revisions;
111 return array_filter($this->revisions,
static fn(
Revision $revision):
bool => $revision->
getStatus() === RevisionStatus::PUBLISHED);
116 if ($this->revisions === []) {
119 return $this->
getCurrent($including_drafts)->getVersionNumber();
125 foreach ($this->revisions as $revision) {
126 $size += $revision->getInformation()->getSize();
replaceAllRevisions(Revision $revision)
replaceSingleRevision(Revision $revision)
getAll(bool $including_drafts)
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
__construct(private ResourceIdentification $identification, private array $revisions=[])
RevisionCollection constructor.
getMax(bool $including_drafts)