MediaWiki REL1_35
|
Value object representing the set of slots belonging to a revision. More...
Public Member Functions | |
__construct ( $slots) | |
Stable to call. | |
__sleep () | |
Implemented to defy serialization. | |
computeSha1 () | |
Computes the combined hash of the revisions's slots. | |
computeSize () | |
Computes the total nominal size of the revision's slots, in bogo-bytes. | |
getContent ( $role) | |
Returns the Content of the given slot. | |
getInheritedSlots () | |
Return all slots that are not not originate in the revision they belong to (that is, they are inherited from some other revision). | |
getOriginalSlots () | |
Return all slots that belong to the revision they originate from (that is, they are not inherited from some other revision). | |
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. | |
getSlot ( $role) | |
Returns the SlotRecord of the given slot. | |
getSlotRoles () | |
Returns the slot names (roles) of all slots present in this revision. | |
getSlots () | |
Returns an associative array that maps role names to SlotRecords. | |
hasSameContent (RevisionSlots $other) | |
Checks whether the other RevisionSlots instance has the same content as this instance. | |
hasSlot ( $role) | |
Returns whether the given slot is set. | |
Protected Attributes | |
SlotRecord[] callable | $slots |
Private Member Functions | |
setSlotsInternal (array $slots) | |
Value object representing the set of slots belonging to a revision.
@newable
Definition at line 41 of file RevisionSlots.php.
MediaWiki\Revision\RevisionSlots::__construct | ( | $slots | ) |
Stable to call.
SlotRecord[] | callable | $slots | SlotRecords, or a callback that returns such a structure. |
Definition at line 52 of file RevisionSlots.php.
References MediaWiki\Revision\RevisionSlots\$slots, and MediaWiki\Revision\RevisionSlots\setSlotsInternal().
MediaWiki\Revision\RevisionSlots::__sleep | ( | ) |
Implemented to defy serialization.
LogicException | always |
Definition at line 82 of file RevisionSlots.php.
MediaWiki\Revision\RevisionSlots::computeSha1 | ( | ) |
Computes the combined hash of the revisions's slots.
Definition at line 200 of file RevisionSlots.php.
References MediaWiki\Revision\RevisionSlots\$slots, MediaWiki\Revision\SlotRecord\base36Sha1(), MediaWiki\Revision\SlotRecord\getSha1(), and MediaWiki\Revision\RevisionSlots\getSlots().
MediaWiki\Revision\RevisionSlots::computeSize | ( | ) |
Computes the total nominal size of the revision's slots, in bogo-bytes.
Definition at line 158 of file RevisionSlots.php.
References MediaWiki\Revision\SlotRecord\getSize(), and MediaWiki\Revision\RevisionSlots\getSlots().
MediaWiki\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. See SlotRecord::getContent() for details. |
Definition at line 101 of file RevisionSlots.php.
References MediaWiki\Revision\RevisionSlots\getSlot().
MediaWiki\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 240 of file RevisionSlots.php.
References MediaWiki\Revision\RevisionSlots\getSlots(), and MediaWiki\Revision\SlotRecord\isInherited().
MediaWiki\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 223 of file RevisionSlots.php.
References MediaWiki\Revision\RevisionSlots\getSlots(), and MediaWiki\Revision\SlotRecord\isInherited().
MediaWiki\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 293 of file RevisionSlots.php.
References $s, $t, and MediaWiki\Revision\RevisionSlots\getSlots().
MediaWiki\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 116 of file RevisionSlots.php.
References MediaWiki\Revision\RevisionSlots\$slots, and MediaWiki\Revision\RevisionSlots\getSlots().
Referenced by MediaWiki\Revision\RevisionSlots\getContent().
MediaWiki\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 145 of file RevisionSlots.php.
References MediaWiki\Revision\RevisionSlots\$slots, and MediaWiki\Revision\RevisionSlots\getSlots().
MediaWiki\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 173 of file RevisionSlots.php.
References MediaWiki\Revision\RevisionSlots\$slots, and MediaWiki\Revision\RevisionSlots\setSlotsInternal().
Referenced by MediaWiki\Revision\RevisionSlots\computeSha1(), MediaWiki\Revision\RevisionSlots\computeSize(), MediaWiki\Revision\RevisionSlots\getInheritedSlots(), MediaWiki\Revision\RevisionSlots\getOriginalSlots(), MediaWiki\Revision\RevisionSlots\getRolesWithDifferentContent(), MediaWiki\Revision\RevisionSlots\getSlot(), MediaWiki\Revision\RevisionSlots\getSlotRoles(), MediaWiki\Revision\RevisionSlots\hasSameContent(), MediaWiki\Revision\RevisionSlots\hasSlot(), MediaWiki\Storage\RevisionSlotsUpdate\newFromRevisionSlots(), MediaWiki\Revision\MutableRevisionSlots\removeSlot(), and MediaWiki\Revision\MutableRevisionSlots\setSlot().
MediaWiki\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 258 of file RevisionSlots.php.
References $s, $t, and MediaWiki\Revision\RevisionSlots\getSlots().
MediaWiki\Revision\RevisionSlots::hasSlot | ( | $role | ) |
Returns whether the given slot is set.
string | $role | The role name of the desired slot |
Definition at line 133 of file RevisionSlots.php.
References MediaWiki\Revision\RevisionSlots\$slots, and MediaWiki\Revision\RevisionSlots\getSlots().
|
private |
SlotRecord[] | $slots |
Definition at line 65 of file RevisionSlots.php.
References MediaWiki\Revision\RevisionSlots\$slots.
Referenced by MediaWiki\Revision\RevisionSlots\__construct(), and MediaWiki\Revision\RevisionSlots\getSlots().
|
protected |
Definition at line 44 of file RevisionSlots.php.
Referenced by MediaWiki\Revision\RevisionSlots\__construct(), MediaWiki\Revision\MutableRevisionSlots\__construct(), MediaWiki\Revision\RevisionSlots\computeSha1(), MediaWiki\Revision\RevisionSlots\getSlot(), MediaWiki\Revision\RevisionSlots\getSlotRoles(), MediaWiki\Revision\RevisionSlots\getSlots(), MediaWiki\Revision\RevisionSlots\hasSlot(), MediaWiki\Revision\MutableRevisionSlots\newFromParentRevisionSlots(), and MediaWiki\Revision\RevisionSlots\setSlotsInternal().