forked from LiveCarta/PayPal-PHP-SDK
Updating ModelAccessValidator to be disabled if not set explicitly
- Disabled if not set - A better debug message
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -18,3 +18,4 @@ composer.lock
|
|||||||
|
|
||||||
# Project
|
# Project
|
||||||
var
|
var
|
||||||
|
tools
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class ModelAccessorValidator
|
|||||||
public static function validate(PayPalModel $class, $attributeName)
|
public static function validate(PayPalModel $class, $attributeName)
|
||||||
{
|
{
|
||||||
$mode = PayPalConfigManager::getInstance()->get('validation.level');
|
$mode = PayPalConfigManager::getInstance()->get('validation.level');
|
||||||
if ($mode != 'disabled') {
|
if (!empty($mode) && $mode != 'disabled') {
|
||||||
//Check if $attributeName is string
|
//Check if $attributeName is string
|
||||||
if (gettype($attributeName) !== 'string') {
|
if (gettype($attributeName) !== 'string') {
|
||||||
return false;
|
return false;
|
||||||
@@ -38,8 +38,8 @@ class ModelAccessorValidator
|
|||||||
elseif (!method_exists($class, $methodName)) {
|
elseif (!method_exists($class, $methodName)) {
|
||||||
//Delegate the error based on the choice
|
//Delegate the error based on the choice
|
||||||
$className = is_object($class) ? get_class($class) : (string)$class;
|
$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";
|
$errorMessage = "Missing Accessor: $className:$methodName. You might be using older version of SDK. If not, create an issue at https://github.com/paypal/PayPal-PHP-SDK/issues";
|
||||||
PayPalLoggingManager::getInstance(__CLASS__)->warning($errorMessage);
|
PayPalLoggingManager::getInstance(__CLASS__)->debug($errorMessage);
|
||||||
if ($mode == 'strict') {
|
if ($mode == 'strict') {
|
||||||
trigger_error($errorMessage, E_USER_NOTICE);
|
trigger_error($errorMessage, E_USER_NOTICE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ log.LogLevel=INFO
|
|||||||
; 'log' : logs the error message to logger only (default)
|
; 'log' : logs the error message to logger only (default)
|
||||||
; 'strict' : throws a php notice message
|
; 'strict' : throws a php notice message
|
||||||
; 'disable' : disable the validation
|
; 'disable' : disable the validation
|
||||||
validation.level=log
|
validation.level=disable
|
||||||
|
|
||||||
;Caching Configuration
|
;Caching Configuration
|
||||||
[cache]
|
[cache]
|
||||||
|
|||||||
Reference in New Issue
Block a user