MediaWiki 1.41.2
Block.php
Go to the documentation of this file.
1<?php
2
22namespace MediaWiki\Block;
23
27
41interface Block extends WikiAwareEntity {
42
43 # TYPE constants
44 # Do not introduce negative constants without changing BlockUser command object.
45 public const TYPE_USER = 1;
46 public const TYPE_IP = 2;
47 public const TYPE_RANGE = 3;
48 public const TYPE_AUTO = 4;
49 public const TYPE_ID = 5;
50
54 public const BLOCK_TYPES = [
55 self::TYPE_USER => 'user',
56 self::TYPE_IP => 'ip',
57 self::TYPE_RANGE => 'range',
58 self::TYPE_AUTO => 'autoblock',
59 self::TYPE_ID => 'id',
60 ];
61
68 public function getId( $wikiId = self::LOCAL ): ?int;
69
79 public function getIdentifier( $wikiId = self::LOCAL );
80
86 public function getBlocker(): ?UserIdentity;
87
94
102
110 public function getTargetName(): string;
111
119 public function isBlocking( $target ): bool;
120
126 public function getExpiry(): string;
127
132 public function getType(): ?int;
133
139 public function getTimestamp(): string;
140
148 public function isSitewide(): bool;
149
157 public function isCreateAccountBlocked(): bool;
158
169 public function isHardblock(): bool;
170
178 public function toArray(): array;
179}
Value object for a comment stored by CommentStore.
Represents a block that may prevent users from performing specific operations.
Definition Block.php:41
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,...
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).
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:54
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.