Page MenuHomeWickedGov Phorge

ContributionsSegment.php
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

ContributionsSegment.php

<?php
namespace MediaWiki\Revision;
use MediaWiki\Message\Message;
/**
* @newable
* @since 1.35
*/
class ContributionsSegment {
/**
* @var RevisionRecord[]
*/
private $revisions;
/**
* @var string[][]
*/
private $tags;
/**
* @var string|null
*/
private $before;
/**
* @var string|null
*/
private $after;
/**
* @var array
*/
private $deltas;
/**
* @var array
*/
private $flags;
/**
* @param RevisionRecord[] $revisions
* @param string[][] $tags Associative array mapping revision IDs to a map of tag names to Message objects
* @param string|null $before
* @param string|null $after
* @param int[] $deltas An associative array mapping a revision Id to the difference in size of this revision
* and its parent revision. Values may be null if the size difference is unknown.
* @param array $flags Is an associative array, known fields are:
* - newest: bool indicating whether this segment is the newest in time
* - oldest: bool indicating whether this segment is the oldest in time
*/
public function __construct(
array $revisions,
array $tags,
?string $before,
?string $after,
array $deltas = [],
array $flags = []
) {
$this->revisions = $revisions;
$this->tags = $tags;
$this->before = $before;
$this->after = $after;
$this->deltas = $deltas;
$this->flags = $flags;
}
/**
* Get tags and associated metadata for a given revision
*
* @param int $revId a revision ID
*
* @return Message[] Associative array mapping tag name to a Message object storing tag display data
*/
public function getTagsForRevision( $revId ): array {
return $this->tags[$revId] ?? [];
}
/**
* @return RevisionRecord[]
*/
public function getRevisions(): array {
return $this->revisions;
}
/**
* @return string|null
*/
public function getBefore(): ?string {
return $this->before;
}
/**
* @return string|null
*/
public function getAfter(): ?string {
return $this->after;
}
/**
* Returns the difference in size of the given revision and its parent revision.
* Returns null if the size difference is unknown.
* @param int $revid Revision id
* @return int|null
*/
public function getDeltaForRevision( int $revid ): ?int {
return $this->deltas[$revid] ?? null;
}
/**
* The value of the 'newest' field of the flags passed to the constructor, or false
* if that field was not set.
*
* @return bool
*/
public function isNewest(): bool {
return $this->flags['newest'] ?? false;
}
/**
* The value of the 'oldest' field of the flags passed to the constructor, or false
* if that field was not set.
*
* @return bool
*/
public function isOldest(): bool {
return $this->flags['oldest'] ?? false;
}
}

File Metadata

Mime Type
text/x-php
Expires
Sun, Oct 26, 07:51 (14 h, 38 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
9e/fe/04017685c39ca2a9ffba203817b0
Default Alt Text
ContributionsSegment.php (2 KB)

Event Timeline