forked from LiveCarta/PayPal-PHP-SDK
[PSR] Fixed library source
- Using `php-cs-fixer` tool.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Common;
|
||||
|
||||
use PayPal\Validation\JsonValidator;
|
||||
use PayPal\Validation\ModelAccessorValidator;
|
||||
|
||||
@@ -67,7 +68,9 @@ class PayPalModel
|
||||
public static function getList($data)
|
||||
{
|
||||
// Return Null if Null
|
||||
if ($data === null) { return null; }
|
||||
if ($data === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (is_a($data, get_class(new \stdClass()))) {
|
||||
//This means, root element is object
|
||||
@@ -173,9 +176,9 @@ class PayPalModel
|
||||
foreach ($param as $k => $v) {
|
||||
if ($v instanceof PayPalModel) {
|
||||
$ret[$k] = $v->toArray();
|
||||
} else if (sizeof($v) <= 0 && is_array($v)) {
|
||||
} elseif (sizeof($v) <= 0 && is_array($v)) {
|
||||
$ret[$k] = array();
|
||||
} else if (is_array($v)) {
|
||||
} elseif (is_array($v)) {
|
||||
$ret[$k] = $this->_convertToArray($v);
|
||||
} else {
|
||||
$ret[$k] = $v;
|
||||
@@ -204,9 +207,9 @@ class PayPalModel
|
||||
// If the value is an array, it means, it is an object after conversion
|
||||
if (is_array($v)) {
|
||||
// Determine the class of the object
|
||||
if (($clazz = ReflectionUtil::getPropertyClass(get_class($this), $k)) != null){
|
||||
if (($clazz = ReflectionUtil::getPropertyClass(get_class($this), $k)) != null) {
|
||||
// If the value is an associative array, it means, its an object. Just make recursive call to it.
|
||||
if (empty($v)){
|
||||
if (empty($v)) {
|
||||
if (ReflectionUtil::isPropertyClassArray(get_class($this), $k)) {
|
||||
// It means, it is an array of objects.
|
||||
$this->assignValue($k, array());
|
||||
|
||||
@@ -115,4 +115,4 @@ class PayPalResourceModel extends PayPalModel implements IResource
|
||||
$apiContext = $apiContext ? $apiContext : new ApiContext(self::$credential);
|
||||
$apiContext->getCredential()->updateAccessToken($apiContext->getConfig(), $refreshToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ class PayPalUserAgent
|
||||
*/
|
||||
public static function getValue($sdkName, $sdkVersion)
|
||||
{
|
||||
|
||||
$featureList = array(
|
||||
'platform-ver=' . PHP_VERSION,
|
||||
'bit=' . self::_getPHPBit(),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Common;
|
||||
|
||||
use PayPal\Exception\PayPalConfigurationException;
|
||||
|
||||
/**
|
||||
@@ -112,7 +113,7 @@ class ReflectionUtil
|
||||
}
|
||||
|
||||
// todo: smarter regexp
|
||||
if ( !preg_match_all(
|
||||
if (!preg_match_all(
|
||||
'~\@([^\s@\(]+)[\t ]*(?:\(?([^\n@]+)\)?)?~i',
|
||||
$refl->getDocComment(),
|
||||
$annots,
|
||||
@@ -120,7 +121,7 @@ class ReflectionUtil
|
||||
return null;
|
||||
}
|
||||
foreach ($annots[1] as $i => $annot) {
|
||||
$annotations[strtolower($annot)] = empty($annots[2][$i]) ? TRUE : rtrim($annots[2][$i], " \t\n\r)");
|
||||
$annotations[strtolower($annot)] = empty($annots[2][$i]) ? true : rtrim($annots[2][$i], " \t\n\r)");
|
||||
}
|
||||
|
||||
return $annotations;
|
||||
|
||||
Reference in New Issue
Block a user