本文整理汇总了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));
}