MediaWiki  master
Block.php
Go to the documentation of this file.
1 <?php
2 
22 namespace MediaWiki\Block;
23 
27 
40 interface Block extends WikiAwareEntity {
41 
42  # TYPE constants
43  # Do not introduce negative constants without changing BlockUser command object.
44  public const TYPE_USER = 1;
45  public const TYPE_IP = 2;
46  public const TYPE_RANGE = 3;
47  public const TYPE_AUTO = 4;
48  public const TYPE_ID = 5;
49 
53  public const BLOCK_TYPES = [
54  self::TYPE_USER => 'user',
55  self::TYPE_IP => 'ip',
56  self::TYPE_RANGE => 'range',
57  self::TYPE_AUTO => 'autoblock',
58  self::TYPE_ID => 'id',
59  ];
60 
67  public function getId( $wikiId = self::LOCAL ): ?int;
68 
78  public function getIdentifier( $wikiId = self::LOCAL );
79 
85  public function getBlocker(): ?UserIdentity;
86 
93 
100  public function getTargetUserIdentity(): ?UserIdentity;
101 
109  public function getTargetName(): string;
110 
118  public function isBlocking( $target ): bool;
119 
125  public function getExpiry(): string;
126 
131  public function getType(): ?int;
132 
138  public function getTimestamp(): string;
139 
147  public function isSitewide(): bool;
148 
156  public function isCreateAccountBlocked(): bool;
157 
165  public function isHardblock(): bool;
166 
167 }
Value object for a comment stored by CommentStore.
Represents a block that may prevent users from performing specific operations.
Definition: Block.php:40
isSitewide()
Indicates that the block is a sitewide block.
isHardblock()
Returns whether the block is a hardblock (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,...
getIdentifier( $wikiId=self::LOCAL)
Get the information that identifies this block, such that a user could look up everything that can be...
isBlocking( $target)
Determines whether this block is blocking the given target (and only that target).
getId( $wikiId=self::LOCAL)
Get the block ID.
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:53
getType()
Get the type of target for this particular block.
getExpiry()
Get the block expiry time.
Marker interface for entities aware of the wiki they belong to.
Interface for objects representing user identity.