<?php
namespace App\Http\Gateway\Interfaces;
/**
- Interface Gateway
- @method get */ interface Gateway{}
Solved it this way
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have several gateways in my app. 5 to different API services and more incoming.
I want to code them to interfaces, but I'm having a hard time deciding the best way. Right now i have 5 implementations and have 5 different interfaces, that i would like to convert to 1 or 2 interfaces.
Most interfaces use a get() function, but each of them have different params. There is one interface that has another optional request to the API which i called getSpecifics().
I figure I can create a different interface for the getSpecifics method as not to break liskov's, but i can't figure out how to solve the multiple params problem.
I've thought about making the contract something like get($param1 = null, $param2 = null, $param3 = null)
But i don't find that way very maintainable. I'm trying to enforce variable types (int $param1, string $param2) and the above way would obviously not be able to type it. Furthermore, i don't think typing n ammounts of default $params is actually a good solution.
Can someone help me thinking this out? Am i overthinking it? Am i wrong? Thanks!
Please or to participate in this conversation.