Go to the documentation of this file.
27 use Wikimedia\Assert\Assert;
45 Assert::parameterType(
'array|callable',
$slots,
'$slots' );
47 if ( is_callable(
$slots ) ) {
58 Assert::parameterElementType( SlotRecord::class,
$slots,
'$slots' );
63 foreach (
$slots as $slot ) {
64 $role = $slot->getRole();
65 $this->slots[$role] = $slot;
75 throw new LogicException( __CLASS__ .
' is not serializable.' );
93 return $this->
getSlot( $role )->getContent()->copy();
109 if ( isset(
$slots[$role] ) ) {
126 return isset(
$slots[$role] );
137 return array_keys(
$slots );
150 return $accu + $slot->
getSize();
164 if ( is_callable( $this->slots ) ) {
165 $slots = call_user_func( $this->slots );
167 Assert::postcondition(
169 'Slots info callback should return an array of objects'
199 return $accu ===
null
249 if ( $other === $this ) {
259 if ( array_keys( $aSlots ) !== array_keys( $bSlots ) ) {
263 foreach ( $aSlots as $role =>
$s ) {
266 if ( !
$s->hasSameContent(
$t ) ) {
284 if ( $other === $this ) {
294 $different = array_keys( array_merge(
295 array_diff_key( $aSlots, $bSlots ),
296 array_diff_key( $bSlots, $aSlots )
300 $common = array_intersect_key( $aSlots, $bSlots );
302 foreach ( $common as $role =>
$s ) {
305 if ( !
$s->hasSameContent(
$t ) ) {
306 $different[] = $role;
319 class_alias( RevisionSlots::class,
'MediaWiki\Storage\RevisionSlots' );
Base interface for content objects.