本文整理匯總了PHP中MWNamespace::equals方法的典型用法代碼示例。如果您正苦於以下問題:PHP MWNamespace::equals方法的具體用法?PHP MWNamespace::equals怎麽用?PHP MWNamespace::equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MWNamespace
的用法示例。
在下文中一共展示了MWNamespace::equals方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: inNamespace
/**
* Returns true if the title is inside the specified namespace.
*
* Please make use of this instead of comparing to getNamespace()
* This function is much more resistant to changes we may make
* to namespaces than code that makes direct comparisons.
* @param int $ns The namespace
* @return bool
* @since 1.19
*/
public function inNamespace($ns)
{
return MWNamespace::equals($this->getNamespace(), $ns);
}
示例2: testEquals
/**
* Test MWNamespace::equals
* Note if we add a namespace registration system with keys like 'MAIN'
* we should add tests here for equivilance on things like 'MAIN' == 0
* and 'MAIN' == NS_MAIN.
*/
public function testEquals()
{
$this->assertTrue(MWNamespace::equals(NS_MAIN, NS_MAIN));
$this->assertTrue(MWNamespace::equals(NS_MAIN, 0));
// In case we make NS_MAIN 'MAIN'
$this->assertTrue(MWNamespace::equals(NS_USER, NS_USER));
$this->assertTrue(MWNamespace::equals(NS_USER, 2));
$this->assertTrue(MWNamespace::equals(NS_USER_TALK, NS_USER_TALK));
$this->assertTrue(MWNamespace::equals(NS_SPECIAL, NS_SPECIAL));
$this->assertFalse(MWNamespace::equals(NS_MAIN, NS_TALK));
$this->assertFalse(MWNamespace::equals(NS_USER, NS_USER_TALK));
$this->assertFalse(MWNamespace::equals(NS_PROJECT, NS_TEMPLATE));
}