本文整理汇总了PHP中SimpleTestCompatibility::isIdentical方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleTestCompatibility::isIdentical方法的具体用法?PHP SimpleTestCompatibility::isIdentical怎么用?PHP SimpleTestCompatibility::isIdentical使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleTestCompatibility
的用法示例。
在下文中一共展示了SimpleTestCompatibility::isIdentical方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isArrayOfIdenticalTypes
/**
* Recursive type test for each element of an array.
* @param mixed $first Test subject.
* @param mixed $second Comparison object.
* @return boolean True if identical.
* @access private
*/
protected static function isArrayOfIdenticalTypes($first, $second)
{
if (array_keys($first) != array_keys($second)) {
return false;
}
foreach (array_keys($first) as $key) {
$is_identical = SimpleTestCompatibility::isIdentical($first[$key], $second[$key]);
if (!$is_identical) {
return false;
}
}
return true;
}
示例2: test
/**
* Tests the expectation. True if it exactly
* matches the held value.
* @param mixed $compare Comparison value.
* @return boolean True if correct.
* @access public
*/
function test($compare)
{
return SimpleTestCompatibility::isIdentical($this->_getValue(), $compare);
}
示例3: isIdentical
/**
* Identity test. Drops back to equality for PHP5
* objects as the === operator counts as the
* stronger reference constraint.
* @param mixed $first Test subject.
* @param mixed $second Comparison object.
* @access public
* @static
*/
function isIdentical($first, $second)
{
if (version_compare(phpversion(), '5') >= 0) {
if (gettype($first) != gettype($second)) {
return false;
}
if ($first != $second) {
return false;
}
if (is_object($first) && is_object($second)) {
return get_class($first) == get_class($second);
}
if (is_array($first) && is_array($second)) {
if (array_keys($first) != array_keys($second)) {
return false;
}
foreach (array_keys($first) as $key) {
if (!SimpleTestCompatibility::isIdentical($first[$key], $second[$key])) {
return false;
}
}
}
return true;
}
return $first === $second;
}
示例4: test
/**
* Tests the expectation. True if it exactly matches the held value.
*
* @param mixed $compare Comparison value.
* @return boolean
*/
public function test($compare)
{
$value = $this->entityToFilteredArray($this->getValue());
$compare = $this->entityToFilteredArray($compare);
return SimpleTestCompatibility::isIdentical($value, $compare);
}