MediaWiki REL1_31
MediaWiki\Storage\MutableRevisionSlots Class Reference

Mutable version of RevisionSlots, for constructing a new revision. More...

Inheritance diagram for MediaWiki\Storage\MutableRevisionSlots:
Collaboration diagram for MediaWiki\Storage\MutableRevisionSlots:

Public Member Functions

 __construct (array $slots=[])
 
 getInheritedSlots ()
 Return all slots that are inherited.
 
 getTouchedSlots ()
 Return all slots that are not inherited.
 
 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\Storage\RevisionSlots
 __construct ( $slots)
 
 __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.
 
 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.
 
 hasSlot ( $role)
 Returns whether the given slot is set.
 

Static Public Member Functions

static newFromParentRevisionSlots (array $slots)
 Constructs a MutableRevisionSlots that inherits from the given list of slots.
 

Additional Inherited Members

- Protected Attributes inherited from MediaWiki\Storage\RevisionSlots
SlotRecord[] callable $slots
 

Detailed Description

Mutable version of RevisionSlots, for constructing a new revision.

Since
1.31

Definition at line 32 of file MutableRevisionSlots.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Storage\MutableRevisionSlots::__construct ( array  $slots = [])
Parameters
SlotRecord[]$slotsAn array of SlotRecords.

Definition at line 55 of file MutableRevisionSlots.php.

References MediaWiki\Storage\RevisionSlots\$slots.

Member Function Documentation

◆ getInheritedSlots()

MediaWiki\Storage\MutableRevisionSlots::getInheritedSlots ( )

Return all slots that are inherited.

Note
This may cause the slot meta-data for the revision to be lazy-loaded.
Returns
SlotRecord[]

Definition at line 128 of file MutableRevisionSlots.php.

References MediaWiki\Storage\RevisionSlots\getSlots(), and MediaWiki\Storage\SlotRecord\isInherited().

◆ getTouchedSlots()

MediaWiki\Storage\MutableRevisionSlots::getTouchedSlots ( )

Return all slots that are not inherited.

Note
This may cause the slot meta-data for the revision to be lazy-loaded.
Returns
SlotRecord[]

Definition at line 112 of file MutableRevisionSlots.php.

References MediaWiki\Storage\RevisionSlots\getSlots(), and MediaWiki\Storage\SlotRecord\isInherited().

◆ newFromParentRevisionSlots()

static MediaWiki\Storage\MutableRevisionSlots::newFromParentRevisionSlots ( array  $slots)
static

Constructs a MutableRevisionSlots that inherits from the given list of slots.

Parameters
SlotRecord[]$slots
Returns
MutableRevisionSlots

Definition at line 42 of file MutableRevisionSlots.php.

References MediaWiki\Storage\RevisionSlots\$slots, as, and MediaWiki\Storage\SlotRecord\newInherited().

◆ removeSlot()

MediaWiki\Storage\MutableRevisionSlots::removeSlot (   $role)

Remove the slot for the given role, discontinue the corresponding stream.

Note
This may cause the slot meta-data for the revision to be lazy-loaded.
Parameters
string$role

Definition at line 97 of file MutableRevisionSlots.php.

References MediaWiki\Storage\RevisionSlots\getSlots().

◆ setContent()

MediaWiki\Storage\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.

Note
This may cause the slot meta-data for the revision to be lazy-loaded.
Parameters
string$role
Content$content

Definition at line 85 of file MutableRevisionSlots.php.

References MediaWiki\Storage\SlotRecord\newUnsaved(), and MediaWiki\Storage\MutableRevisionSlots\setSlot().

◆ setSlot()

MediaWiki\Storage\MutableRevisionSlots::setSlot ( SlotRecord  $slot)

Sets the given slot.

If a slot with the same role is already present, it is replaced.

Note
This may cause the slot meta-data for the revision to be lazy-loaded.
Parameters
SlotRecord$slot

Definition at line 67 of file MutableRevisionSlots.php.

References MediaWiki\Storage\SlotRecord\getRole(), and MediaWiki\Storage\RevisionSlots\getSlots().

Referenced by MediaWiki\Storage\MutableRevisionSlots\setContent().


The documentation for this class was generated from the following file: