please help i have 5 different api class here is my problem what should i need to use to
reduce this. cos every time i make other new api. i create new class and given method same as other i do search like some design pattern like factory, interfaces and polymorpism i want to use something that help me to make a another copy of new api easier for example here is my method for each api
class ApiObject() {
- Withdraw method()
- deposit method()
- register method()
- login method()
}
here is my list of api api1,api2,api3,api4 and api5 all this api have same method like
withdraw and deposit referrence abovei dont know what exact pattern should i use
this what i think by making like this for all api so i can easily use class
blueprints by passing my new api with credentials and some method please
enlighten me on what should i use
$Api1 = APIObject(apicredentials,url,methods);
$Api2 = APIObject(apicredentials,url,methods);
$Api3 = APIObject(apicredentials,url,methods);
$Api4 = APIObject(apicredentials,url,methods);
$Api5 = APIObject(apicredentials,url,methods);
$newApi = APIObject(apicredentials,url,methods);
thanks in advance **
Aucun commentaire:
Enregistrer un commentaire