Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
build
.DS_Store
phpunit.local.xml
.phpunit.result.cache
*.log

# IDE
Expand All @@ -21,5 +22,5 @@ composer.phar
var
tools

# Groc
# Groc
node_modules
1 change: 1 addition & 0 deletions .phpunit.result.cache

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@
"psr/log": "^1.0 || ^2.0 || ^3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35",
"phpunit/phpunit": "^9.5",
"rector/rector": "^2.0"
},
"autoload": {
"psr-0": {
"PayPal": "lib/"
}
},
"autoload-dev": {
"psr-0": {
"PayPal\\Test": "tests/PayPal/Test/"
}
}
}
12 changes: 6 additions & 6 deletions lib/PayPal/Api/Agreement.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@ public function getOverrideChargeModels()
public function addOverrideChargeModel($overrideChargeModel)
{
if (!$this->getOverrideChargeModels()) {
return $this->setOverrideChargeModels(array($overrideChargeModel));
return $this->setOverrideChargeModels([$overrideChargeModel]);
} else {
return $this->setOverrideChargeModels(
array_merge($this->getOverrideChargeModels(), array($overrideChargeModel))
array_merge($this->getOverrideChargeModels(), [$overrideChargeModel])
);
}
}
Expand All @@ -264,7 +264,7 @@ public function addOverrideChargeModel($overrideChargeModel)
public function removeOverrideChargeModel($overrideChargeModel)
{
return $this->setOverrideChargeModels(
array_diff($this->getOverrideChargeModels(), array($overrideChargeModel))
array_diff($this->getOverrideChargeModels(), [$overrideChargeModel])
);
}

Expand Down Expand Up @@ -620,15 +620,15 @@ public static function transactions($agreementId, $apiContext = null, $restCall
* @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
* @return AgreementTransactions
*/
public static function searchTransactions($agreementId, $params = array(), $apiContext = null, $restCall = null)
public static function searchTransactions($agreementId, $params = [], $apiContext = null, $restCall = null)
{
ArgumentValidator::validate($agreementId, 'agreementId');
ArgumentValidator::validate($params, 'params');

$allowedParams = array(
$allowedParams = [
'start_date' => 1,
'end_date' => 1,
);
];

$payLoad = "";
$json = self::executeCall(
Expand Down
6 changes: 3 additions & 3 deletions lib/PayPal/Api/AgreementTransactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public function getAgreementTransactionList()
public function addAgreementTransactionList($agreementTransaction)
{
if (!$this->getAgreementTransactionList()) {
return $this->setAgreementTransactionList(array($agreementTransaction));
return $this->setAgreementTransactionList([$agreementTransaction]);
} else {
return $this->setAgreementTransactionList(
array_merge($this->getAgreementTransactionList(), array($agreementTransaction))
array_merge($this->getAgreementTransactionList(), [$agreementTransaction])
);
}
}
Expand All @@ -64,7 +64,7 @@ public function addAgreementTransactionList($agreementTransaction)
public function removeAgreementTransactionList($agreementTransaction)
{
return $this->setAgreementTransactionList(
array_diff($this->getAgreementTransactionList(), array($agreementTransaction))
array_diff($this->getAgreementTransactionList(), [$agreementTransaction])
);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/PayPal/Api/BankAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,10 +605,10 @@ public function getLinks()
public function addLink($links)
{
if (!$this->getLinks()) {
return $this->setLinks(array($links));
return $this->setLinks([$links]);
} else {
return $this->setLinks(
array_merge($this->getLinks(), array($links))
array_merge($this->getLinks(), [$links])
);
}
}
Expand All @@ -622,7 +622,7 @@ public function addLink($links)
public function removeLink($links)
{
return $this->setLinks(
array_diff($this->getLinks(), array($links))
array_diff($this->getLinks(), [$links])
);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/PayPal/Api/BankAccountsList.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public function getBankAccounts()
public function addBankAccount($bankAccount)
{
if (!$this->getBankAccounts()) {
return $this->setBankAccounts(array($bankAccount));
return $this->setBankAccounts([$bankAccount]);
} else {
return $this->setBankAccounts(
array_merge($this->getBankAccounts(), array($bankAccount))
array_merge($this->getBankAccounts(), [$bankAccount])
);
}
}
Expand All @@ -66,7 +66,7 @@ public function addBankAccount($bankAccount)
public function removeBankAccount($bankAccount)
{
return $this->setBankAccounts(
array_diff($this->getBankAccounts(), array($bankAccount))
array_diff($this->getBankAccounts(), [$bankAccount])
);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/PayPal/Api/CancelNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ public function getCcEmails()
public function addCcEmail($string)
{
if (!$this->getCcEmails()) {
return $this->setCcEmails(array($string));
return $this->setCcEmails([$string]);
} else {
return $this->setCcEmails(
array_merge($this->getCcEmails(), array($string))
array_merge($this->getCcEmails(), [$string])
);
}
}
Expand All @@ -160,7 +160,7 @@ public function addCcEmail($string)
public function removeCcEmail($string)
{
return $this->setCcEmails(
array_diff($this->getCcEmails(), array($string))
array_diff($this->getCcEmails(), [$string])
);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/PayPal/Api/CartBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,10 @@ public function getExternalFunding()
public function addExternalFunding($externalFunding)
{
if (!$this->getExternalFunding()) {
return $this->setExternalFunding(array($externalFunding));
return $this->setExternalFunding([$externalFunding]);
} else {
return $this->setExternalFunding(
array_merge($this->getExternalFunding(), array($externalFunding))
array_merge($this->getExternalFunding(), [$externalFunding])
);
}
}
Expand All @@ -401,7 +401,7 @@ public function addExternalFunding($externalFunding)
public function removeExternalFunding($externalFunding)
{
return $this->setExternalFunding(
array_diff($this->getExternalFunding(), array($externalFunding))
array_diff($this->getExternalFunding(), [$externalFunding])
);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/PayPal/Api/CreditCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,11 +528,11 @@ public function update($patchRequest, $apiContext = null, $restCall = null)
public static function all($params, $apiContext = null, $restCall = null)
{
if (is_null($params)) {
$params = array();
$params = [];
}
ArgumentValidator::validate($params, 'params');
$payLoad = "";
$allowedParams = array(
$allowedParams = [
'page_size' => 1,
'page' => 1,
'start_time' => 1,
Expand All @@ -543,7 +543,7 @@ public static function all($params, $apiContext = null, $restCall = null)
'external_card_id' => 1,
'external_customer_id' => 1,
'total_required' => 1
);
];
$json = self::executeCall(
"/v1/vault/credit-cards" . "?" . http_build_query(array_intersect_key($params, $allowedParams)),
"GET",
Expand Down
6 changes: 3 additions & 3 deletions lib/PayPal/Api/CreditCardList.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ public function getItems()
public function addItem($creditCard)
{
if (!$this->getItems()) {
return $this->setItems(array($creditCard));
return $this->setItems([$creditCard]);
} else {
return $this->setItems(
array_merge($this->getItems(), array($creditCard))
array_merge($this->getItems(), [$creditCard])
);
}
}
Expand All @@ -67,7 +67,7 @@ public function addItem($creditCard)
public function removeItem($creditCard)
{
return $this->setItems(
array_diff($this->getItems(), array($creditCard))
array_diff($this->getItems(), [$creditCard])
);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/PayPal/Api/CurrencyConversion.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,10 @@ public function getLinks()
public function addLink($links)
{
if (!$this->getLinks()) {
return $this->setLinks(array($links));
return $this->setLinks([$links]);
} else {
return $this->setLinks(
array_merge($this->getLinks(), array($links))
array_merge($this->getLinks(), [$links])
);
}
}
Expand All @@ -259,7 +259,7 @@ public function addLink($links)
public function removeLink($links)
{
return $this->setLinks(
array_diff($this->getLinks(), array($links))
array_diff($this->getLinks(), [$links])
);
}

Expand Down
12 changes: 6 additions & 6 deletions lib/PayPal/Api/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ public function getDetails()
public function addDetail($errorDetails)
{
if (!$this->getDetails()) {
return $this->setDetails(array($errorDetails));
return $this->setDetails([$errorDetails]);
} else {
return $this->setDetails(
array_merge($this->getDetails(), array($errorDetails))
array_merge($this->getDetails(), [$errorDetails])
);
}
}
Expand All @@ -211,7 +211,7 @@ public function addDetail($errorDetails)
public function removeDetail($errorDetails)
{
return $this->setDetails(
array_diff($this->getDetails(), array($errorDetails))
array_diff($this->getDetails(), [$errorDetails])
);
}

Expand Down Expand Up @@ -297,10 +297,10 @@ public function getLinks()
public function addLink($links)
{
if (!$this->getLinks()) {
return $this->setLinks(array($links));
return $this->setLinks([$links]);
} else {
return $this->setLinks(
array_merge($this->getLinks(), array($links))
array_merge($this->getLinks(), [$links])
);
}
}
Expand All @@ -314,7 +314,7 @@ public function addLink($links)
public function removeLink($links)
{
return $this->setLinks(
array_diff($this->getLinks(), array($links))
array_diff($this->getLinks(), [$links])
);
}
}
12 changes: 6 additions & 6 deletions lib/PayPal/Api/FundingOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ public function getFundingSources()
public function addFundingSource($fundingSource)
{
if (!$this->getFundingSources()) {
return $this->setFundingSources(array($fundingSource));
return $this->setFundingSources([$fundingSource]);
} else {
return $this->setFundingSources(
array_merge($this->getFundingSources(), array($fundingSource))
array_merge($this->getFundingSources(), [$fundingSource])
);
}
}
Expand All @@ -92,7 +92,7 @@ public function addFundingSource($fundingSource)
public function removeFundingSource($fundingSource)
{
return $this->setFundingSources(
array_diff($this->getFundingSources(), array($fundingSource))
array_diff($this->getFundingSources(), [$fundingSource])
);
}

Expand Down Expand Up @@ -197,10 +197,10 @@ public function getLinks()
public function addLink($links)
{
if (!$this->getLinks()) {
return $this->setLinks(array($links));
return $this->setLinks([$links]);
} else {
return $this->setLinks(
array_merge($this->getLinks(), array($links))
array_merge($this->getLinks(), [$links])
);
}
}
Expand All @@ -214,7 +214,7 @@ public function addLink($links)
public function removeLink($links)
{
return $this->setLinks(
array_diff($this->getLinks(), array($links))
array_diff($this->getLinks(), [$links])
);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/PayPal/Api/FundingSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,10 @@ public function getLinks()
public function addLink($links)
{
if (!$this->getLinks()) {
return $this->setLinks(array($links));
return $this->setLinks([$links]);
} else {
return $this->setLinks(
array_merge($this->getLinks(), array($links))
array_merge($this->getLinks(), [$links])
);
}
}
Expand All @@ -285,7 +285,7 @@ public function addLink($links)
public function removeLink($links)
{
return $this->setLinks(
array_diff($this->getLinks(), array($links))
array_diff($this->getLinks(), [$links])
);
}

Expand Down
8 changes: 4 additions & 4 deletions lib/PayPal/Api/FuturePayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ class FuturePayment extends Payment
*/
public function create($apiContext = null, $clientMetadataId = null, $restCall = null)
{
$headers = array();
$headers = [];
if ($clientMetadataId != null) {
$headers = array(
$headers = [
'PAYPAL-CLIENT-METADATA-ID' => $clientMetadataId
);
];
}
$payLoad = $this->toJSON();
$json = self::executeCall(
Expand All @@ -51,7 +51,7 @@ public function create($apiContext = null, $clientMetadataId = null, $restCall =
*/
public static function getRefreshToken($authorizationCode, $apiContext = null)
{
$apiContext = $apiContext ? $apiContext : new ApiContext(self::$credential);
$apiContext = $apiContext ?: new ApiContext(self::$credential);
$credential = $apiContext->getCredential();
return $credential->getRefreshToken($apiContext->getConfig(), $authorizationCode);
}
Expand Down
Loading