Merge "Add support for PHP7 random_bytes in favor of mcrypt_create_iv"
[lhc/web/wiklou.git] / includes / title / TitleValue.php
index 63c075f..7c370f1 100644 (file)
@@ -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
         */