MediaWiki REL1_35
|
Mutable version of RevisionSlots, for constructing a new revision. More...
Public Member Functions | |
__construct (array $slots=[], ?callable $resetCallback=null) | |
inheritSlot (SlotRecord $slot) | |
Sets the given slot to an inherited version of $slot. | |
removeSlot ( $role) | |
Remove the slot for the given role, discontinue the corresponding stream. | |
setContent ( $role, Content $content) | |
Sets the content for the slot with the given role. | |
setSlot (SlotRecord $slot) | |
Sets the given slot. | |
Public Member Functions inherited from MediaWiki\Revision\RevisionSlots | |
__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. | |
Static Public Member Functions | |
static | newFromParentRevisionSlots (array $slots, ?callable $resetCallback=null) |
Constructs a MutableRevisionSlots that inherits from the given list of slots. | |
Private Member Functions | |
triggerResetCallback () | |
Trigger the reset callback supplied to the constructor, if any. | |
Private Attributes | |
callable null | $resetCallback |
Additional Inherited Members | |
Protected Attributes inherited from MediaWiki\Revision\RevisionSlots | |
SlotRecord[] callable | $slots |
Mutable version of RevisionSlots, for constructing a new revision.
Definition at line 33 of file MutableRevisionSlots.php.
MediaWiki\Revision\MutableRevisionSlots::__construct | ( | array | $slots = [] , |
?callable | $resetCallback = null |
||
) |
SlotRecord[] | $slots | An array of SlotRecords. |
callable | null | $resetCallback | Callback to be triggered whenever slots change. Signature: function ( MutableRevisionSlots ): void. |
Definition at line 67 of file MutableRevisionSlots.php.
References MediaWiki\Revision\MutableRevisionSlots\$resetCallback, and MediaWiki\Revision\RevisionSlots\$slots.
MediaWiki\Revision\MutableRevisionSlots::inheritSlot | ( | SlotRecord | $slot | ) |
Sets the given slot to an inherited version of $slot.
If a slot with the same role is already present, it is replaced.
SlotRecord | $slot |
Definition at line 95 of file MutableRevisionSlots.php.
References MediaWiki\Revision\SlotRecord\newInherited(), and MediaWiki\Revision\MutableRevisionSlots\setSlot().
|
static |
Constructs a MutableRevisionSlots that inherits from the given list of slots.
SlotRecord[] | $slots | |
callable | null | $resetCallback | Callback to be triggered whenever slots change. Signature: function ( MutableRevisionSlots ): void. |
Definition at line 49 of file MutableRevisionSlots.php.
References MediaWiki\Revision\MutableRevisionSlots\$resetCallback, MediaWiki\Revision\RevisionSlots\$slots, and MediaWiki\Revision\SlotRecord\newInherited().
MediaWiki\Revision\MutableRevisionSlots::removeSlot | ( | $role | ) |
Remove the slot for the given role, discontinue the corresponding stream.
string | $role |
Definition at line 116 of file MutableRevisionSlots.php.
References MediaWiki\Revision\RevisionSlots\getSlots(), and MediaWiki\Revision\MutableRevisionSlots\triggerResetCallback().
Referenced by MediaWiki\Storage\RevisionSlotsUpdate\apply().
MediaWiki\Revision\MutableRevisionSlots::setContent | ( | $role, | |
Content | $content | ||
) |
Sets the content for the slot with the given role.
If a slot with the same role is already present, it is replaced.
string | $role | |
Content | $content |
Definition at line 106 of file MutableRevisionSlots.php.
References $content, MediaWiki\Revision\SlotRecord\newUnsaved(), and MediaWiki\Revision\MutableRevisionSlots\setSlot().
MediaWiki\Revision\MutableRevisionSlots::setSlot | ( | SlotRecord | $slot | ) |
Sets the given slot.
If a slot with the same role is already present, it is replaced.
SlotRecord | $slot |
Definition at line 79 of file MutableRevisionSlots.php.
References MediaWiki\Revision\SlotRecord\getRole(), MediaWiki\Revision\RevisionSlots\getSlots(), and MediaWiki\Revision\MutableRevisionSlots\triggerResetCallback().
Referenced by MediaWiki\Storage\RevisionSlotsUpdate\apply(), MediaWiki\Revision\MutableRevisionSlots\inheritSlot(), and MediaWiki\Revision\MutableRevisionSlots\setContent().
|
private |
Trigger the reset callback supplied to the constructor, if any.
Definition at line 128 of file MutableRevisionSlots.php.
References MediaWiki\Revision\MutableRevisionSlots\$resetCallback.
Referenced by MediaWiki\Revision\MutableRevisionSlots\removeSlot(), and MediaWiki\Revision\MutableRevisionSlots\setSlot().
|
private |
Definition at line 37 of file MutableRevisionSlots.php.
Referenced by MediaWiki\Revision\MutableRevisionSlots\__construct(), MediaWiki\Revision\MutableRevisionSlots\newFromParentRevisionSlots(), and MediaWiki\Revision\MutableRevisionSlots\triggerResetCallback().