Page MenuHomeWickedGov Phorge

TitleConditionValue.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

TitleConditionValue.php

<?php
namespace MediaWiki\RecentChanges\ChangesListQuery;
use MediaWiki\Linker\LinkTarget;
use MediaWiki\Page\PageReference;
/**
* A simple value class and helpers for a namespace/dbkey pair
*
* @internal Helper for ChangesListQuery modules
*/
class TitleConditionValue implements \Stringable {
/**
* @param LinkTarget|PageReference $title
* @return self
*/
public static function create( $title ) {
if ( $title instanceof LinkTarget ) {
$ns = $title->getNamespace();
$dbk = $title->getDBkey();
} elseif ( $title instanceof PageReference ) {
$ns = $title->getNamespace();
$dbk = $title->getDBkey();
} else {
throw new \InvalidArgumentException(
"Unknown value type for title"
);
}
return new self ( $ns, $dbk );
}
/**
* @param self[] $values
* @return array
*/
public static function makeSet( $values ) {
$set = [];
foreach ( $values as $value ) {
$set[$value->namespace][$value->dbKey] = true;
}
return $set;
}
public function __construct(
public int $namespace,
public string $dbKey
) {
}
public function __toString(): string {
return "{$this->namespace}:{$this->dbKey}";
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Nov 21, 15:43 (6 h, 14 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
33/49/27742fd750ce1d8cd6e20898c238
Default Alt Text
TitleConditionValue.php (1 KB)

Event Timeline