本文整理汇总了PHP中question_utils::arrays_same_at_key_missing_is_blank方法的典型用法代码示例。如果您正苦于以下问题:PHP question_utils::arrays_same_at_key_missing_is_blank方法的具体用法?PHP question_utils::arrays_same_at_key_missing_is_blank怎么用?PHP question_utils::arrays_same_at_key_missing_is_blank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类question_utils
的用法示例。
在下文中一共展示了question_utils::arrays_same_at_key_missing_is_blank方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_arrays_same_at_key_missing_is_blank
public function test_arrays_same_at_key_missing_is_blank()
{
$this->assertTrue(question_utils::arrays_same_at_key_missing_is_blank(array(), array(), 'key'));
$this->assertFalse(question_utils::arrays_same_at_key_missing_is_blank(array(), array('key' => 1), 'key'));
$this->assertFalse(question_utils::arrays_same_at_key_missing_is_blank(array('key' => 1), array(), 'key'));
$this->assertTrue(question_utils::arrays_same_at_key_missing_is_blank(array('key' => 1), array('key' => 1), 'key'));
$this->assertFalse(question_utils::arrays_same_at_key_missing_is_blank(array('key' => 1), array('key' => 2), 'key'));
$this->assertTrue(question_utils::arrays_same_at_key_missing_is_blank(array('key' => 1), array('key' => '1'), 'key'));
$this->assertFalse(question_utils::arrays_same_at_key_missing_is_blank(array('key' => '0'), array('key' => ''), 'key'));
$this->assertTrue(question_utils::arrays_same_at_key_missing_is_blank(array(), array('key' => ''), 'key'));
}
示例2: is_same_response
public function is_same_response(array $prevresponse, array $newresponse)
{
if (array_key_exists('answer', $prevresponse) && $prevresponse['answer'] !== $this->responsetemplate) {
$value1 = (string) $prevresponse['answer'];
} else {
$value1 = '';
}
if (array_key_exists('answer', $newresponse) && $newresponse['answer'] !== $this->responsetemplate) {
$value2 = (string) $newresponse['answer'];
} else {
$value2 = '';
}
return $value1 === $value2 && ($this->attachments == 0 || question_utils::arrays_same_at_key_missing_is_blank($prevresponse, $newresponse, 'attachments'));
}
示例3: is_same_response
public function is_same_response(array $prevresponse, array $newresponse)
{
if (!question_utils::arrays_same_at_key_missing_is_blank($prevresponse, $newresponse, 'answer')) {
return false;
}
if ($this->has_separate_unit_field()) {
return question_utils::arrays_same_at_key_missing_is_blank($prevresponse, $newresponse, 'unit');
}
return true;
}
示例4: is_same_response
public function is_same_response(array $prevresponse, array $newresponse)
{
return question_utils::arrays_same_at_key_missing_is_blank($prevresponse, $newresponse, 'answer') && ($this->attachments == 0 || question_utils::arrays_same_at_key_missing_is_blank($prevresponse, $newresponse, 'attachments'));
}
示例5: is_same_prt_input
protected function is_same_prt_input($index, $prtinput1, $prtinput2)
{
foreach ($this->prts[$index]->get_required_variables(array_keys($this->inputs)) as $name) {
if (!question_utils::arrays_same_at_key_missing_is_blank($prtinput1, $prtinput2, $name)) {
return false;
}
}
return true;
}
示例6: is_same_response
public function is_same_response(array $prevresponse, array $newresponse)
{
foreach ($this->get_parameters() as $param) {
if (!question_utils::arrays_same_at_key_missing_is_blank($prevresponse, $newresponse, 'answer_' . $param)) {
return false;
}
}
return true;
}
示例7: is_same_response
public function is_same_response(array $prevresponse, array $newresponse) {
if (!question_utils::arrays_same_at_key_missing_is_blank(
$prevresponse, $newresponse, 'answer')) {
return false;
}
if ($this->unitdisplay == qtype_numerical::UNITSELECT) {
return question_utils::arrays_same_at_key_missing_is_blank(
$prevresponse, $newresponse, 'unit');
}
return false;
}
示例8: is_same_response
/** This function is used by the question engine to prevent regrading of
* unchanged submissions.
*
* @param array $prevresponse
* @param array $newresponse
* @return boolean
*/
public function is_same_response(array $prevresponse, array $newresponse)
{
if (!question_utils::arrays_same_at_key_missing_is_blank($prevresponse, $newresponse, 'answer') || !question_utils::arrays_same_at_key_integer($prevresponse, $newresponse, 'rating')) {
return false;
}
return true;
}