MediaWiki master
Block.php
Go to the documentation of this file.
1<?php
2
22namespace MediaWiki\Block;
23
27
45interface Block extends WikiAwareEntity {
46
47 # TYPE constants
48 # Do not introduce negative constants without changing BlockUser command object.
49 public const TYPE_USER = 1;
50 public const TYPE_IP = 2;
51 public const TYPE_RANGE = 3;
52 public const TYPE_AUTO = 4;
53
57 public const BLOCK_TYPES = [
58 self::TYPE_USER => 'user',
59 self::TYPE_IP => 'ip',
60 self::TYPE_RANGE => 'range',
61 self::TYPE_AUTO => 'autoblock',
62 ];
63
70 public function getId( $wikiId = self::LOCAL ): ?int;
71
81 public function getIdentifier( $wikiId = self::LOCAL );
82
88 public function getBlocker(): ?UserIdentity;
89
96
107 public function getTarget(): ?BlockTarget;
108
116 public function getRedactedTarget(): ?BlockTarget;
117
125
133 public function getTargetName(): string;
134
142 public function isBlocking( $target ): bool;
143
149 public function getExpiry(): string;
150
157 public function isIndefinite(): bool;
158
163 public function getType(): ?int;
164
170 public function getTimestamp(): string;
171
179 public function isSitewide(): bool;
180
188 public function isCreateAccountBlocked(): bool;
189
200 public function isHardblock(): bool;
201
209 public function toArray(): array;
210}
Base class for block targets.
Value object for a comment stored by CommentStore.
Represents a block that may prevent users from performing specific operations.
Definition Block.php:45
isSitewide()
Get whether the block is a sitewide block.
isHardblock()
Get whether the block is a hard block (affects logged-in users on a given IP/range).
getBlocker()
Get the user who applied this block.
getTimestamp()
Get the timestamp indicating when the block was created.
getTargetName()
Return the name of the block target as a string.
getTargetUserIdentity()
Get the UserIdentity identifying the blocked user, if the target is indeed a user (that is,...
getTarget()
Get the target as an object.
getIdentifier( $wikiId=self::LOCAL)
Get the information that identifies this block, such that a user could look up everything that can be...
isBlocking( $target)
Determine whether this block is blocking the given target (and only that target).
getRedactedTarget()
Get the target, with the IP address hidden behind an AutoBlockTarget if the block is an autoblock.
getId( $wikiId=self::LOCAL)
Get the block ID.
toArray()
Convert a block to an array of blocks.
getReasonComment()
Get the reason for creating the block.
isCreateAccountBlocked()
Get the flag indicating whether this block blocks the target from creating an account.
const BLOCK_TYPES
Map block types to strings, to allow convenient logging.
Definition Block.php:57
getType()
Get the type of target for this particular block.
isIndefinite()
Is the block indefinite (with no fixed expiry)?
getExpiry()
Get the block expiry time.
Marker interface for entities aware of the wiki they belong to.
Interface for objects representing user identity.