public function setProperties($properties) { if (empty($properties)) { return; } while (list($key, $value) = each($properties)) { if (is_valid_prop($key)) { $this->{$key} = $value; } } }
/** * Assignment occurs only on properties * of this which are not already set * * @param array $properties property => value pairs */ public function setProperties($properties) { if (!is_array($properties)) { $properties = array($properties); } while (list($name, $value) = each($properties)) { if (!is_valid_prop($name)) { error_log("'{$name}' is an invalid property name when building form."); continue; } // ignore it if it was already set if (!isset($this->{$name})) { $this->{$name} = $value; } } }
/** * This function should only be called internally as it * bypasses any filtering. Assignment occurs only on properties * of this which are not already set * * @param array $properties property => value pairs */ public function _setProperties($properties) { while (list($name, $value) = each($properties)) { // ignore it if it was already set if (is_valid_prop($name)) { $this->{$name} = $value; } } }