forked from LiveCarta/PayPal-PHP-SDK
Returns False on Validation for Access Modifier on generic PPModel object
- Fixes #171 Issue
This commit is contained in:
@@ -26,8 +26,12 @@ class ModelAccessorValidator
|
||||
if ($mode != 'disabled') {
|
||||
//If the mode is disabled, bypass the validation
|
||||
foreach (array('set' . $attributeName, 'get' . $attributeName) as $methodName) {
|
||||
if (get_class($class) == "PayPal\\Common\\PPModel") {
|
||||
// Silently return false on cases where you are using PPModel instance directly
|
||||
return false;
|
||||
}
|
||||
//Check if both getter and setter exists for given attribute
|
||||
if (!method_exists($class, $methodName)) {
|
||||
elseif (!method_exists($class, $methodName)) {
|
||||
//Delegate the error based on the choice
|
||||
$className = is_object($class) ? get_class($class) : (string)$class;
|
||||
$errorMessage = "Missing Accessor: $className:$methodName. Please let us know by creating an issue at https://github.com/paypal/PayPal-PHP-SDK/issues";
|
||||
|
||||
Reference in New Issue
Block a user