Git Product home page Git Product logo

Comments (10)

lstrojny avatar lstrojny commented on June 23, 2024

@sagikazarmark very fair criticism of the interface, I wholeheartedly agree. On the options: I feel extending another interface makes most sense, I for now struggle with the name.

from fxmlrpc.

sagikazarmark avatar sagikazarmark commented on June 23, 2024

Callable and Configurable interface are probably more generic.

from fxmlrpc.

sagikazarmark avatar sagikazarmark commented on June 23, 2024

Further thinking about it: I think that the main interface should be the one containing call and multicall. So it should be ClientInterface. Of course, it is a BC breaking change.

from fxmlrpc.

lstrojny avatar lstrojny commented on June 23, 2024

I would do something like this:

interface CallClientInterface
{
    public function call(string $method, array $arguments): mixed;
}

interface MulticallClientInterface
{
    public function multicall(): MulticallInterface;
}

interface ClientInterface extends CallClientInterface, MulticallClientInterface
{
}

interface HandlerInterface
{
   public function onError(callable $handler): HandlerInterface;
   public function onSuccess(callable $handler): HandlerInterface;
}

interface MulticallInterface extends HandlerInterface
{
    public addCall(string $methodName, array $params = [], callable $onSuccess = null, callable $onErrors = null): MulticallInterface;
    public function execute(): array;
}

What do you think?

from fxmlrpc.

sagikazarmark avatar sagikazarmark commented on June 23, 2024

Not sure I understand the reason of having a separate handler interface. Other than that it looks good.

from fxmlrpc.

lstrojny avatar lstrojny commented on June 23, 2024

Yeah, good point. Maybe calling it MulticallBuilderInterface and moving all of them into the same interface is the nicer option. At the end it is a builder alike problem that we are dealing with.

from fxmlrpc.

sagikazarmark avatar sagikazarmark commented on June 23, 2024

Yeah, builder sounds good.

from fxmlrpc.

lstrojny avatar lstrojny commented on June 23, 2024

@sagikazarmark can you have a look?

from fxmlrpc.

sagikazarmark avatar sagikazarmark commented on June 23, 2024

Looks good.

from fxmlrpc.

lstrojny avatar lstrojny commented on June 23, 2024

Merged into develop

from fxmlrpc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.