Using Setter Methods instead of Magic if possible.

This commit is contained in:
Jay Patel
2015-10-06 19:08:30 -05:00
parent c10526e34b
commit 97493db230

View File

@@ -248,7 +248,13 @@ class PayPalModel
private function assignValue($key, $value)
{
$this->__set($key, $value);
$setter = 'set'. $this->convertToCamelCase($key);
// If we find the setter, use that, otherwise use magic method.
if (method_exists($this, $setter)) {
$this->$setter($value);
} else {
$this->__set($key, $value);
}
}
/**