public function hasNeeds($optionsList)
{
$needs = $this->getNeeds();
$definedOptions = array_keys($optionsList);
$notFound = array();
foreach ($needs as $need) {
if (!in_array($need, $definedOptions)) {
// The needed option has not been defined as a valid flag.
$notFound[] = $need;
} elseif (!$optionsList[$need]->getValue()) {
// The needed option has been defined as a valid flag, but was
// not pased in by the user.
$notFound[] = $need;
}
}
return empty($notFound) ? true : $notFound;
}
/** * Test that the needed requirements are met */ public function testOptionRequirementsMet() { $option = new Option('f'); $option->setNeeds('foo'); $optionSet = array('foo' => new Option('foo')); $this->assertTrue($option->hasNeeds($optionSet)); }