Closed joelwurtz closed 8 years ago
since actually the target repo for httplug still has the options parameters in sendRequest
Are you sure it is still the case?
I'm pretty sure :)
utility_separation branch on httplug was based on a commit before this change (if you do a composer install here you will still have the $options parameter, unless #5 is merged)
Ah, the dependency thing. Sure.
Merged
Yes that was not very clear sorry :/
@joelwurtz thanks for this PR. We really needed this and I have to admit, I did not have the patience to do this refactoring.
I commented on a few minor things, but no big deals. Can you check them please? Thank you in advance.
This should be good, and rebase against master
I've spotted a few other issues which must be solved:
inheritdoc
@joelwurtz May I ask you to check these out too?
This should be good, and rebase against master
Sorry, I am not sure I can follow. What do we have to rebase?
Sorry, I am not sure I can follow. What do we have to rebase?
Just say my PR was rebased against master (since the merged in #5).
I've spotted a few other issues which must be solved:
Exceptions must also be cloned here Most of docblocks can be be removed and replaced by inheritdoc @joelwurtz May I ask you to check these out too?
No problem
Ah, I see. Great and thanks.
Not sure how to clone the exceptions array as an exception is not clonable ?
It is not an array, but an SplObjectStorage
. Although you made a point. Exceptions themselves are not cloneable.
Can you check out which is the default behaviour of cloning an SplObjectStorage: are the underlying objects cloned too?
I add a test to valid the behavior (like adding an exception then a request which should keep the previous exception) it seems to work.
So i believe that underlying object are not cloned only the array but reference are still the same
Hm. Not sure if it's bad or good. But let's keep it that way then for now.
Pinging @dbu to let him know the situation. Do you think that this could cause problems in the future?
Also i remove the BodyGenerator believing it was part of the Body classes, but now i'm not sure, what was the purpose of that interface ?
I intended to use the BodyGenerator name instead of Body as the idea was to use them to generate string body and headers which then can be injected into one of the HTTP methods instead of the Body object itself. Then we invalidated the idea, so Generator can go as well.
About BatchResultSpec: the initialized object should be checked if it is a BatchResult OBJECT, and a new test should be added to test if the current subject implements our BatchResult INTERFACE.
About BatchResultSpec: the initialized object should be checked if it is a BatchResult OBJECT, and a new test should be added to test if the current subject implements our BatchResult INTERFACE.
Is the good behavior now ? (not used to phpsec :/)
Perfect. Is it ready for merging?
Think so, do we wait for dbu input about cloning SplObjectStorage ?
Nope, that's just a note to him, also this is how I originally solved it, so even if it is wrong, we can stick to it in the update context.
Further thinking about this: technically BatchResult is immutable. The object itself, the storage objects and the request objects are immutable. Exceptions are mostly read-only.
Thank you @joelwurtz
I update the library (tests are ok if the 2 pr are merged, since actually the httplug dependency in this package still has the options parameters in sendRequest) :