Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class BillingServiceFactory
- {
- public static function create(User $user): BillingService
- {
- if ($user->isDemo()) {
- return new DemoBillingService();
- } elseif ($user->hasParam1()) {
- return new Api1BillingService($apiV1Url, $apiV1Key);
- } elseif ($user->hasParam2()) {
- return new Api2BillingService($apiV2Url, $apiV1Key);
- } elseif ($user->hasParam3()) {
- return new Api3BillingService($apiV3Url, $apiV1Key);
- }
- return null;
- }
- }
- class Api1BillingService {
- public function __construct(string $url, string $privateKey) {
- $this->url = $url;
- $this->privateKey = $privateKey;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement