function testArrayMember() { $this->sendMessage("test"); $this->assertTrue(arrays::member(1, array(1))); $this->assertFalse(arrays::member(1, array())); $this->assertFalse(arrays::member(1, array(2, 3))); }
/** * @return var * @param $arraySearch Array * @param $arraySearch Array * @desc checks array membership in arrays */ function searchArray($arraySearch, $arrayCheck) { for ($index = 0; $index < sizeof($arraySearch); $index++) { if (arrays::member($arraySearch[$index], $arrayCheck)) { return $arraySearch[$index]; } } return false; }
/** * @return array - an array of unique timepoints * @desc Locate the timepoints of all the before predicates */ function findallTimepoints() { $timepoints = array(); for ($index = 0; $index < sizeof($this->constructs); $index++) { //Do not add the timepoint if it is already in the list if (!arrays::member($this->constructs[$index]->getTimePoints(), $timepoints)) { array_push($timepoints, $this->constructs[$index]->getTimePoints()); } } return $timepoints; }
/** * @return Array of Edges * @param String $name * @param Array $history * @desc Find all orderings linking into the passed node */ function findBackwardsConnections($name, $history) { $nodeList = array(); $edgesSize = sizeof($this->edges); for ($index = 0; $index < $edgesSize; $index++) { $result = $this->edges[$index]->matchReverse($name); if ($result && !arrays::member($result, $history)) { array_push($nodeList, $result); } } return $nodeList; }
function checkForLoop($entryTimepoint) { return arrays::member($entryTimepoint, $this->history); }
/** * @return Array * @param unknown $dbfield * @param unknown $current * @param unknown $value * @param unknown $displayvalue * @desc get the data for a checkbox */ function getdata_checkbox($dbfield, $current, $value, $displayvalue) { $result['name'] = $dbfield; if ($displayvalue) { $result['displayvalue'] = $displayvalue; } $result['value'] = $value; if (!is_array($current)) { $result['match'] = match($current, $value, ''); } else { // current is an array $result['match'] = arrays::member($value, $current); } return $result; }