abstract class AbstractRestriction implements Restriction {
+ /**
+ * String constant identifying the type of restriction. Expected to be overriden in subclasses
+ * with a non-empty string value.
+ */
+ const TYPE = '';
+
+ /**
+ * 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.
+ */
+ const TYPE_ID = 0;
+
/**
* @var int
*/
/**
* Create Restriction.
*
+ * @since 1.33
* @param int $blockId
* @param int $value
*/
}
/**
- * {@inheritdoc}
+ * @inheritDoc
+ */
+ public static function getType() {
+ return static::TYPE;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public static function getTypeId() {
+ return static::TYPE_ID;
+ }
+
+ /**
+ * @inheritDoc
*/
public function getBlockId() {
return $this->blockId;
}
/**
- * {@inheritdoc}
+ * @inheritDoc
*/
public function setBlockId( $blockId ) {
$this->blockId = (int)$blockId;
}
/**
- * {@inheritdoc}
+ * @inheritDoc
*/
public function getValue() {
return $this->value;
}
/**
- * {@inheritdoc}
+ * @inheritDoc
*/
public static function newFromRow( \stdClass $row ) {
+ // @phan-suppress-next-line PhanTypeInstantiateAbstract
return new static( $row->ir_ipb_id, $row->ir_value );
}
/**
- * {@inheritdoc}
+ * @inheritDoc
*/
public function toRow() {
return [
}
/**
- * {@inheritdoc}
+ * @inheritDoc
*/
public function equals( Restriction $other ) {
return $this->getHash() === $other->getHash();
}
/**
- * {@inheritdoc}
+ * @inheritDoc
*/
public function getHash() {
return $this->getType() . '-' . $this->getValue();