本文整理汇总了PHP中CMbArray::first方法的典型用法代码示例。如果您正苦于以下问题:PHP CMbArray::first方法的具体用法?PHP CMbArray::first怎么用?PHP CMbArray::first使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMbArray
的用法示例。
在下文中一共展示了CMbArray::first方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBasculeCode
/**
* Get bascule HL7 event code
*
* @param CSejour $from Admit from
* @param CSejour $to Admit to
*
* @return string
*/
function getBasculeCode(CSejour $from, CSejour $to)
{
$matrix = array("comp/M" => array(null, "Z99", "Z99", "Z99", "Z99", "A07", "Z99", "A07"), "comp/C" => array("Z99", null, "Z99", "Z99", "Z99", "A07", "Z99", "A07"), "comp/O" => array("Z99", "Z99", null, "Z99", "Z99", "A07", "Z99", "A07"), "bebe/*" => array("A06", "A06", "A06", null, "A06", "A07", "A06", "A07"), "ambu/*" => array("Z99", "Z99", "Z99", "Z99", null, "A07", "Z99", "A07"), "urg/*" => array("A06", "A06", "A06", "A06", "A06", null, "A06", "Z99"), "seances/*" => array("Z99", "Z99", "Z99", "Z99", "Z99", "A07", null, "A07"), "exte/*" => array("A06", "A06", "A06", "A06", "A06", "Z99", "A06", null));
$from->completeField("type", "type_pec");
$type_from = $from->type;
$type_pec_from = $from->type_pec;
$to->completeField("type", "type_pec");
$type_to = $to->type;
$type_pec_to = $to->type_pec;
// psy || ssr == seances
if (in_array($type_from, array("psy", "ssr"))) {
$type_from = "seances";
}
if (in_array($type_to, array("psy", "ssr"))) {
$type_to = "seances";
}
/* // TODO prendre en compte les sejours de type nouveau né
$naissances = $from->loadRefsNaissances();
foreach ($naissances as $_naissance) {
if ($naissances->sejour_bebe_id == $from->_id) {
$type_from = "bebe";
break;
}
}*/
$row = CMbArray::first($matrix, array("{$type_from}/{$type_pec_from}", "{$type_from}/*"));
if (!$row) {
return $this->getModificationAdmitCode($from->_receiver);
}
$columns = array_flip(array_keys($matrix));
$col_num = CMbArray::first($columns, array("{$type_to}/{$type_pec_to}", "{$type_to}/*"));
if ($columns === null) {
return $this->getModificationAdmitCode($from->_receiver);
}
if ($row[$col_num] == "Z99") {
return $this->getModificationAdmitCode($from->_receiver);
}
return $row[$col_num];
}
示例2: testFirst
public function testFirst()
{
$this->assertEquals("val1", $this->stub->first(array("key1" => "val1", "key2" => "val2", "key3" => "val3"), array("key1", "key2")));
$this->assertNull($this->stub->first(array("val"), array("notAkey")));
}