Merge pull request #20 from litvinenkow/patch-1

Update Fenom.php. Fix: options as array doesn't work
This commit is contained in:
Ivan Shalganov 2013-07-18 02:00:47 -07:00
commit 175902bf6e

View File

@ -731,12 +731,12 @@ class Fenom {
* @throws \RuntimeException if key from custom assoc doesn't exists into possible values * @throws \RuntimeException if key from custom assoc doesn't exists into possible values
*/ */
private static function _makeMask(array $values, array $options, $mask = 0) { private static function _makeMask(array $values, array $options, $mask = 0) {
foreach($values as $value) { foreach ($values as $key=>$value) {
if(isset($options[$value])) { if (isset($options[$key])) {
if($options[$value]) { if ($options[$key]) {
$mask |= $options[$value]; $mask |= $options[$key];
} else { } else {
$mask &= ~$options[$value]; $mask &= ~$options[$key];
} }
} else { } else {
throw new \RuntimeException("Undefined parameter $value"); throw new \RuntimeException("Undefined parameter $value");