MediaWiki
1.34.0
|
Value object representing the set of slots belonging to a revision. More...
Public Member Functions | |
__construct ( $slots) | |
__sleep () | |
Implemented to defy serialization. More... | |
computeSha1 () | |
Computes the combined hash of the revisions's slots. More... | |
computeSize () | |
Computes the total nominal size of the revision's slots, in bogo-bytes. More... | |
getContent ( $role) | |
Returns the Content of the given slot. More... | |
getInheritedSlots () | |
Return all slots that are not not originate in the revision they belong to (that is, they are inherited from some other revision). More... | |
getOriginalSlots () | |
Return all slots that belong to the revision they originate from (that is, they are not inherited from some other revision). More... | |
getRolesWithDifferentContent (RevisionSlots $other) | |
Find roles for which the $other RevisionSlots object has different content as this RevisionSlots object, including any roles that are present in one but not the other. More... | |
getSlot ( $role) | |
Returns the SlotRecord of the given slot. More... | |
getSlotRoles () | |
Returns the slot names (roles) of all slots present in this revision. More... | |
getSlots () | |
Returns an associative array that maps role names to SlotRecords. More... | |
hasSameContent (RevisionSlots $other) | |
Checks whether the other RevisionSlots instance has the same content as this instance. More... | |
hasSlot ( $role) | |
Returns whether the given slot is set. More... | |
Protected Attributes | |
SlotRecord[] callable | $slots |
Private Member Functions | |
setSlotsInternal (array $slots) | |
Value object representing the set of slots belonging to a revision.
Definition at line 35 of file RevisionSlots.php.
Revision\RevisionSlots::__construct | ( | $slots | ) |
SlotRecord[] | callable | $slots | SlotRecords, or a callback that returns such a structure. |
Definition at line 44 of file RevisionSlots.php.
References Revision\RevisionSlots\$slots, and Revision\RevisionSlots\setSlotsInternal().
Revision\RevisionSlots::__sleep | ( | ) |
Implemented to defy serialization.
LogicException | always |
Definition at line 74 of file RevisionSlots.php.
Revision\RevisionSlots::computeSha1 | ( | ) |
Computes the combined hash of the revisions's slots.
Definition at line 190 of file RevisionSlots.php.
References Revision\RevisionSlots\$slots, Revision\SlotRecord\base36Sha1(), Revision\SlotRecord\getSha1(), and Revision\RevisionSlots\getSlots().
Revision\RevisionSlots::computeSize | ( | ) |
Computes the total nominal size of the revision's slots, in bogo-bytes.
Definition at line 148 of file RevisionSlots.php.
References Revision\SlotRecord\getSize(), and Revision\RevisionSlots\getSlots().
Revision\RevisionSlots::getContent | ( | $role | ) |
Returns the Content of the given slot.
Call getSlotNames() to get a list of available slots.
Note that for mutable Content objects, each call to this method will return a fresh clone.
string | $role | The role name of the desired slot |
RevisionAccessException | if the slot does not exist or slot data could not be lazy-loaded. |
Definition at line 91 of file RevisionSlots.php.
References Revision\RevisionSlots\getSlot().
Revision\RevisionSlots::getInheritedSlots | ( | ) |
Return all slots that are not not originate in the revision they belong to (that is, they are inherited from some other revision).
Definition at line 230 of file RevisionSlots.php.
References Revision\RevisionSlots\getSlots(), and Revision\SlotRecord\isInherited().
Revision\RevisionSlots::getOriginalSlots | ( | ) |
Return all slots that belong to the revision they originate from (that is, they are not inherited from some other revision).
Definition at line 213 of file RevisionSlots.php.
References Revision\RevisionSlots\getSlots(), and Revision\SlotRecord\isInherited().
Revision\RevisionSlots::getRolesWithDifferentContent | ( | RevisionSlots | $other | ) |
Find roles for which the $other RevisionSlots object has different content as this RevisionSlots object, including any roles that are present in one but not the other.
RevisionSlots | $other |
Definition at line 283 of file RevisionSlots.php.
References $s, $t, and Revision\RevisionSlots\getSlots().
Revision\RevisionSlots::getSlot | ( | $role | ) |
Returns the SlotRecord of the given slot.
Call getSlotNames() to get a list of available slots.
string | $role | The role name of the desired slot |
RevisionAccessException | if the slot does not exist or slot data could not be lazy-loaded. |
Definition at line 106 of file RevisionSlots.php.
References Revision\RevisionSlots\$slots, and Revision\RevisionSlots\getSlots().
Referenced by Revision\RevisionSlots\getContent().
Revision\RevisionSlots::getSlotRoles | ( | ) |
Returns the slot names (roles) of all slots present in this revision.
getContent() will succeed only for the names returned by this method.
Definition at line 135 of file RevisionSlots.php.
References Revision\RevisionSlots\$slots, and Revision\RevisionSlots\getSlots().
Revision\RevisionSlots::getSlots | ( | ) |
Returns an associative array that maps role names to SlotRecords.
Each SlotRecord represents the content meta-data of a slot, together they define the content of a revision.
Definition at line 163 of file RevisionSlots.php.
References Revision\RevisionSlots\$slots, and Revision\RevisionSlots\setSlotsInternal().
Referenced by Revision\RevisionSlots\computeSha1(), Revision\RevisionSlots\computeSize(), Revision\RevisionSlots\getInheritedSlots(), Revision\RevisionSlots\getOriginalSlots(), Revision\RevisionSlots\getRolesWithDifferentContent(), Revision\RevisionSlots\getSlot(), Revision\RevisionSlots\getSlotRoles(), Revision\RevisionSlots\hasSameContent(), Revision\RevisionSlots\hasSlot(), MediaWiki\Storage\RevisionSlotsUpdate\newFromRevisionSlots(), Revision\MutableRevisionSlots\removeSlot(), and Revision\MutableRevisionSlots\setSlot().
Revision\RevisionSlots::hasSameContent | ( | RevisionSlots | $other | ) |
Checks whether the other RevisionSlots instance has the same content as this instance.
Note that this does not mean that the slots have to be the same: they could for instance belong to different revisions.
RevisionSlots | $other |
Definition at line 248 of file RevisionSlots.php.
References $s, $t, and Revision\RevisionSlots\getSlots().
Revision\RevisionSlots::hasSlot | ( | $role | ) |
Returns whether the given slot is set.
string | $role | The role name of the desired slot |
Definition at line 123 of file RevisionSlots.php.
References Revision\RevisionSlots\$slots, and Revision\RevisionSlots\getSlots().
|
private |
SlotRecord[] | $slots |
Definition at line 57 of file RevisionSlots.php.
References Revision\RevisionSlots\$slots.
Referenced by Revision\RevisionSlots\__construct(), and Revision\RevisionSlots\getSlots().
|
protected |
Definition at line 38 of file RevisionSlots.php.
Referenced by Revision\RevisionSlots\__construct(), Revision\MutableRevisionSlots\__construct(), Revision\RevisionSlots\computeSha1(), Revision\RevisionSlots\getSlot(), Revision\RevisionSlots\getSlotRoles(), Revision\RevisionSlots\getSlots(), Revision\RevisionSlots\hasSlot(), Revision\MutableRevisionSlots\newFromParentRevisionSlots(), and Revision\RevisionSlots\setSlotsInternal().