Giter VIP home page Giter VIP logo

Comments (5)

ameenross avatar ameenross commented on July 26, 2024

Actually, there's getClient. It's just protected is all. I have considered making it public in the past, but decided not to, because I figured the main class might only be an obstacle for a developer with more custom needs.

I don't think proxying all methods is a good idea, unless the wrapper function actually adds value (which is the case for the functions currently in there). Making the getClient function public is probably the best solution.

from postnl.

tomhooijenga avatar tomhooijenga commented on July 26, 2024

I think it it is more convenient to have the getClient method public. That way, there is a single access point to the api. This also prevents the consumer from dealing with the SecurityHeader. Are there any downsides in doing this?

from postnl.

ameenross avatar ameenross commented on July 26, 2024

Are there any downsides in doing this?

Probably only psychological. In other words, no :)

from postnl.

ameenross avatar ameenross commented on July 26, 2024

On second thought, that would result in code like this (and wouldn't catch CIF exceptions):

$request = new ComplexTypes\CompleteStatusRequest($message, $customer, $shipment);

// Query the webservice and return the result.
return $postnl->getClient('ShippingStatusClient')->completeStatus($request);

Making the call method available would be preferable, and using that will result in something like this (AND have proper CIF error handling):

$request = new ComplexTypes\CompleteStatusRequest($message, $customer, $shipment);

// Query the webservice and return the result.
return $postnl->call('ShippingStatusClient', 'completeStatus', $request);

If you agree then I'll patch it.

from postnl.

tomhooijenga avatar tomhooijenga commented on July 26, 2024

That is probably better. Great work!

from postnl.

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.