X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ftitle%2FTitleValue.php;h=7c370f1ae56d29e4e347be1f4a9e43da725288de;hb=3d068e653b04aaf27ab33697d904cc5ebe6c180a;hp=63c075f1c5f596305190668508d05561cccf0fad;hpb=fd42f6c8486e27d7f386e2467b5c92a30371a2bf;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/title/TitleValue.php b/includes/title/TitleValue.php index 63c075f1c5..7c370f1ae5 100644 --- a/includes/title/TitleValue.php +++ b/includes/title/TitleValue.php @@ -78,7 +78,8 @@ class TitleValue implements LinkTarget { Assert::parameterType( 'string', $interwiki, '$interwiki' ); // Sanity check, no full validation or normalization applied here! - Assert::parameter( !preg_match( '/^_|[ \r\n\t]|_$/', $dbkey ), '$dbkey', 'invalid DB key' ); + Assert::parameter( !preg_match( '/^_|[ \r\n\t]|_$/', $dbkey ), '$dbkey', + "invalid DB key '$dbkey'" ); Assert::parameter( $dbkey !== '', '$dbkey', 'should not be empty' ); $this->namespace = $namespace; @@ -94,6 +95,15 @@ class TitleValue implements LinkTarget { return $this->namespace; } + /** + * @since 1.27 + * @param int $ns + * @return bool + */ + public function inNamespace( $ns ) { + return $this->namespace == $ns; + } + /** * @return string */