39 private $modifiedSlots = [];
44 private $removedRoles = [];
64 foreach ( $parentSlots->getSlots() as $role => $slot ) {
65 if ( !isset( $modified[$role] ) ) {
67 } elseif ( $slot->hasSameContent( $modified[$role] ) ) {
69 unset( $modified[$role] );
94 foreach ( $newContent as $role => $content ) {
95 $slot = SlotRecord::newUnsaved( $role, $content );
98 && $parentSlots->hasSlot( $role )
99 && $slot->hasSameContent( $parentSlots->getSlot( $role ) )
105 $modified[$role] = $slot;
115 public function __construct( array $modifiedSlots = [], array $removedRoles = [] ) {
116 foreach ( $modifiedSlots as $slot ) {
120 foreach ( $removedRoles as $role ) {
137 return array_keys( $this->modifiedSlots );
147 return array_keys( $this->removedRoles );
172 unset( $this->removedRoles[$role] );
173 $this->modifiedSlots[$role] = $slot;
184 $slot = SlotRecord::newUnsaved( $role, $content );
197 unset( $this->modifiedSlots[$role] );
198 $this->removedRoles[$role] =
true;
217 if ( isset( $this->modifiedSlots[$role] ) ) {
218 return $this->modifiedSlots[$role];
221 'No such slot: {role}',
237 return isset( $this->modifiedSlots[$role] );
250 return isset( $this->removedRoles[$role] );
278 if ( !$s->hasSameContent( $t ) ) {
Base interface for representing page content.