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 public const TYPE_ID = 5;
54
58 public const BLOCK_TYPES = [
59 self::TYPE_USER => 'user',
60 self::TYPE_IP => 'ip',
61 self::TYPE_RANGE => 'range',
62 self::TYPE_AUTO => 'autoblock',
63 self::TYPE_ID => 'id',
64 ];
65
72 public function getId( $wikiId = self::LOCAL ): ?int;
73
83 public function getIdentifier( $wikiId = self::LOCAL );
84
90 public function getBlocker(): ?UserIdentity;
91
98
106
114 public function getTargetName(): string;
115
123 public function isBlocking( $target ): bool;
124
130 public function getExpiry(): string;
131
136 public function getType(): ?int;
137
143 public function getTimestamp(): string;
144
152 public function isSitewide(): bool;
153
161 public function isCreateAccountBlocked(): bool;
162
173 public function isHardblock(): bool;
174
182 public function toArray(): array;
183}
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,...
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:58
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.