Page MenuHomePhabricator
Paste P45878

gateway interface and gateway classes
ActivePublic

Authored by jgleeson on Mar 15 2023, 10:29 PM.
Tags
None
Referenced Files
F36913659: gateway interface and gateway classes
Mar 15 2023, 10:29 PM
Subscribers
None
// Gateway Interface
interface UserGateway {
public function getUserData($userId);
}
// Gateway Class for External System 1
class ExternalSystem1Gateway implements UserGateway {
public function getUserData($userId) {
// Code to fetch user data from External System 1
// For simplicity, we return a hardcoded response
return [
'id' => $userId,
'name' => 'John Doe',
'email' => 'john@example.com'
];
}
}
// Gateway Class for External System 2
class ExternalSystem2Gateway implements UserGateway {
public function getUserData($userId) {
// Code to fetch user data from External System 2
// For simplicity, we return a hardcoded response
return [
'userId' => $userId,
'userName' => 'Jane Doe',
'userEmail' => 'jane@example.com'
];
}
}