Created
March 26, 2025 03:28
-
-
Save elminson/43e25d22d2b5bab718f096d8c6f9d517 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace FerminNamespace\Traits; | |
use Srmklive\PayPal\Traits\PayPalHttpClient; | |
use Symfony\Component\HttpClient\HttpClient; | |
trait CustomPayPalHttpClient | |
{ | |
// Use the original trait | |
use PayPalHttpClient; | |
// Override the setClient method completely | |
public function setClient(?HttpClient $client = null): self | |
{ | |
// Your custom implementation here | |
if ($client !== null) { | |
// Custom logic for when a specific client is provided | |
$this->client = $client; | |
return $this; | |
} | |
// Custom client creation logic | |
$this->client = HttpClient::create([ | |
// Your custom configuration | |
'base_uri' => 'https://custom-paypal-endpoint.com', | |
'timeout' => 10, | |
// Add any other specific configurations | |
]); | |
return $this; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment