MediaWiki  1.34.0
MediaWiki\Block\Restriction\AbstractRestriction Class Reference
Inheritance diagram for MediaWiki\Block\Restriction\AbstractRestriction:
Collaboration diagram for MediaWiki\Block\Restriction\AbstractRestriction:

Public Member Functions

 __construct ( $blockId, $value)
 Create Restriction. More...
 
 equals (Restriction $other)
 Determine if a restriction equals another restriction.
Since
1.33
Parameters
Restriction$other
Returns
bool
More...
 
 getBlockId ()
 Gets the id of the block.
Since
1.33
Returns
int
More...
 
 getHash ()
 Create a unique hash of the block restriction based on the type and value.
Since
1.33
Returns
string
More...
 
 getValue ()
 Gets the value of the restriction.
Since
1.33
Returns
int
More...
 
 setBlockId ( $blockId)
 Sets the id of the block.
Since
1.33
Parameters
int$blockId
Returns
self
More...
 
 toRow ()
 Convert a restriction object into a row array for insertion.
Since
1.33
Returns
array
More...
 
- Public Member Functions inherited from MediaWiki\Block\Restriction\Restriction
 matches (\Title $title)
 Determine if a restriction matches a given title. More...
 

Static Public Member Functions

static getType ()
 Gets the type of restriction.
Since
1.33
Returns
string
More...
 
static getTypeId ()
 Gets the id of the type of restriction.This id is used in the database.
Since
1.33
Returns
int
More...
 
static newFromRow (\stdClass $row)
 Creates a new Restriction from a database row.
Since
1.33
Parameters
\\stdClass$row
Returns
static
More...
 

Public Attributes

const TYPE = ''
 String constant identifying the type of restriction. More...
 
const TYPE_ID = 0
 Numeric type identifier. More...
 

Protected Attributes

int $blockId
 
int $value
 

Detailed Description

Definition at line 25 of file AbstractRestriction.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Block\Restriction\AbstractRestriction::__construct (   $blockId,
  $value 
)

Create Restriction.

Since
1.33
Parameters
int$blockId
int$value

Definition at line 56 of file AbstractRestriction.php.

References MediaWiki\Block\Restriction\AbstractRestriction\$blockId, MediaWiki\Block\Restriction\AbstractRestriction\$value, and value.

Member Function Documentation

◆ equals()

MediaWiki\Block\Restriction\AbstractRestriction::equals ( Restriction  $other)

Determine if a restriction equals another restriction.

Since
1.33
Parameters
Restriction$other
Returns
bool

Implements MediaWiki\Block\Restriction\Restriction.

Definition at line 120 of file AbstractRestriction.php.

References MediaWiki\Block\Restriction\Restriction\getHash(), and MediaWiki\Block\Restriction\AbstractRestriction\getHash().

◆ getBlockId()

MediaWiki\Block\Restriction\AbstractRestriction::getBlockId ( )

Gets the id of the block.

Since
1.33
Returns
int

Implements MediaWiki\Block\Restriction\Restriction.

Definition at line 78 of file AbstractRestriction.php.

References MediaWiki\Block\Restriction\AbstractRestriction\$blockId.

Referenced by MediaWiki\Block\Restriction\AbstractRestriction\toRow().

◆ getHash()

MediaWiki\Block\Restriction\AbstractRestriction::getHash ( )

Create a unique hash of the block restriction based on the type and value.

Since
1.33
Returns
string

Implements MediaWiki\Block\Restriction\Restriction.

Definition at line 127 of file AbstractRestriction.php.

References MediaWiki\Block\Restriction\AbstractRestriction\getType(), and MediaWiki\Block\Restriction\AbstractRestriction\getValue().

Referenced by MediaWiki\Block\Restriction\AbstractRestriction\equals().

◆ getType()

static MediaWiki\Block\Restriction\AbstractRestriction::getType ( )
static

Gets the type of restriction.

Since
1.33
Returns
string

Implements MediaWiki\Block\Restriction\Restriction.

Definition at line 64 of file AbstractRestriction.php.

Referenced by MediaWiki\Block\Restriction\AbstractRestriction\getHash().

◆ getTypeId()

static MediaWiki\Block\Restriction\AbstractRestriction::getTypeId ( )
static

Gets the id of the type of restriction.This id is used in the database.

Since
1.33
Returns
int

Implements MediaWiki\Block\Restriction\Restriction.

Definition at line 71 of file AbstractRestriction.php.

Referenced by MediaWiki\Block\Restriction\AbstractRestriction\toRow().

◆ getValue()

MediaWiki\Block\Restriction\AbstractRestriction::getValue ( )

◆ newFromRow()

static MediaWiki\Block\Restriction\AbstractRestriction::newFromRow ( \stdClass  $row)
static

Creates a new Restriction from a database row.

Since
1.33
Parameters
\\stdClass$row
Returns
static

Implements MediaWiki\Block\Restriction\Restriction.

Reimplemented in MediaWiki\Block\Restriction\PageRestriction.

Definition at line 101 of file AbstractRestriction.php.

◆ setBlockId()

MediaWiki\Block\Restriction\AbstractRestriction::setBlockId (   $blockId)

Sets the id of the block.

Since
1.33
Parameters
int$blockId
Returns
self

Implements MediaWiki\Block\Restriction\Restriction.

Definition at line 85 of file AbstractRestriction.php.

References MediaWiki\Block\Restriction\AbstractRestriction\$blockId.

◆ toRow()

MediaWiki\Block\Restriction\AbstractRestriction::toRow ( )

Member Data Documentation

◆ $blockId

◆ $value

int MediaWiki\Block\Restriction\AbstractRestriction::$value
protected

◆ TYPE

const MediaWiki\Block\Restriction\AbstractRestriction::TYPE = ''

String constant identifying the type of restriction.

Expected to be overriden in subclasses with a non-empty string value.

Definition at line 31 of file AbstractRestriction.php.

◆ TYPE_ID

const MediaWiki\Block\Restriction\AbstractRestriction::TYPE_ID = 0

Numeric type identifier.

Expected to be overriden in subclasses with a non-zero integer number. Must not exceed 127 to fit into a TINYINT database field.

Definition at line 37 of file AbstractRestriction.php.


The documentation for this class was generated from the following file: