MediaWiki  master
ContributionsSegment.php
Go to the documentation of this file.
1 <?php
2 
3 namespace MediaWiki\Revision;
4 
5 use Message;
6 
12 
16  private $revisions;
17 
21  private $tags;
22 
26  private $before;
27 
31  private $after;
32 
36  private $deltas;
37 
41  private $flags;
42 
54  public function __construct(
55  array $revisions,
56  array $tags,
57  ?string $before,
58  ?string $after,
59  array $deltas = [],
60  array $flags = []
61  ) {
62  $this->revisions = $revisions;
63  $this->tags = $tags;
64  $this->before = $before;
65  $this->after = $after;
66  $this->deltas = $deltas;
67  $this->flags = $flags;
68  }
69 
77  public function getTagsForRevision( $revId ): array {
78  return $this->tags[$revId] ?? [];
79  }
80 
84  public function getRevisions(): array {
85  return $this->revisions;
86  }
87 
91  public function getBefore(): ?string {
92  return $this->before;
93  }
94 
98  public function getAfter(): ?string {
99  return $this->after;
100  }
101 
108  public function getDeltaForRevision( int $revid ): ?int {
109  return $this->deltas[$revid] ?? null;
110  }
111 
118  public function isNewest(): bool {
119  return $this->flags['newest'] ?? false;
120  }
121 
128  public function isOldest(): bool {
129  return $this->flags['oldest'] ?? false;
130  }
131 
132 }
MediaWiki\Revision\RevisionRecord
Page revision base class.
Definition: RevisionRecord.php:47
MediaWiki\Revision\ContributionsSegment\getRevisions
getRevisions()
Definition: ContributionsSegment.php:84
MediaWiki\Revision\ContributionsSegment\$tags
string[][] $tags
Definition: ContributionsSegment.php:21
MediaWiki\Revision\ContributionsSegment\getBefore
getBefore()
Definition: ContributionsSegment.php:91
MediaWiki\Revision\ContributionsSegment\__construct
__construct(array $revisions, array $tags, ?string $before, ?string $after, array $deltas=[], array $flags=[])
Definition: ContributionsSegment.php:54
MediaWiki\Revision\ContributionsSegment\isNewest
isNewest()
The value of the 'newest' field of the flags passed to the constructor, or false if that field was no...
Definition: ContributionsSegment.php:118
MediaWiki\Revision
Definition: ContributionsLookup.php:3
MediaWiki\Revision\ContributionsSegment\getAfter
getAfter()
Definition: ContributionsSegment.php:98
MediaWiki\Revision\ContributionsSegment\getTagsForRevision
getTagsForRevision( $revId)
Get tags and associated metadata for a given revision.
Definition: ContributionsSegment.php:77
MediaWiki\Revision\ContributionsSegment
@newable
Definition: ContributionsSegment.php:11
MediaWiki\Revision\ContributionsSegment\$after
string null $after
Definition: ContributionsSegment.php:31
MediaWiki\Revision\ContributionsSegment\$deltas
array $deltas
Definition: ContributionsSegment.php:36
MediaWiki\Revision\ContributionsSegment\$revisions
RevisionRecord[] $revisions
Definition: ContributionsSegment.php:16
MediaWiki\Revision\ContributionsSegment\$flags
array $flags
Definition: ContributionsSegment.php:41
Message
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition: Message.php:138
MediaWiki\Revision\ContributionsSegment\getDeltaForRevision
getDeltaForRevision(int $revid)
Returns the difference in size of the given revision and its parent revision.
Definition: ContributionsSegment.php:108
MediaWiki\Revision\ContributionsSegment\$before
string null $before
Definition: ContributionsSegment.php:26
MediaWiki\Revision\ContributionsSegment\isOldest
isOldest()
The value of the 'oldest' field of the flags passed to the constructor, or false if that field was no...
Definition: ContributionsSegment.php:128