Skip to content
This repository was archived by the owner on Jan 16, 2018. It is now read-only.

Conversation

@joelwurtz
Copy link
Member

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) :

@sagikazarmark
Copy link
Member

since actually the target repo for httplug still has the options parameters in sendRequest

Are you sure it is still the case?

@joelwurtz
Copy link
Member Author

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)

@sagikazarmark
Copy link
Member

Ah, the dependency thing. Sure.

@sagikazarmark
Copy link
Member

Merged

@joelwurtz
Copy link
Member Author

Yes that was not very clear sorry :/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we test the BatchResult implementing the BatchResult interface here?

@sagikazarmark
Copy link
Member

@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.

@joelwurtz
Copy link
Member Author

This should be good, and rebase against master

@sagikazarmark
Copy link
Member

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?

@sagikazarmark
Copy link
Member

This should be good, and rebase against master

Sorry, I am not sure I can follow. What do we have to rebase?

@joelwurtz
Copy link
Member Author

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

@sagikazarmark
Copy link
Member

Ah, I see. Great and thanks.

@joelwurtz
Copy link
Member Author

Not sure how to clone the exceptions array as an exception is not clonable ?

@sagikazarmark
Copy link
Member

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?

@joelwurtz
Copy link
Member Author

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

@sagikazarmark
Copy link
Member

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?

@joelwurtz
Copy link
Member Author

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 ?

@sagikazarmark
Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slash is not required in case of strings: they are imported fromthe root namespace anyway.

@sagikazarmark
Copy link
Member

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.

  - Remove Body implementation according to #3
  - Remove options from sendRequest
  - Readapt BatchResult with changes from BatchResult / BatchException
@joelwurtz
Copy link
Member Author

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 :/)

@sagikazarmark
Copy link
Member

Perfect. Is it ready for merging?

@joelwurtz
Copy link
Member Author

Think so, do we wait for dbu input about cloning SplObjectStorage ?

@sagikazarmark
Copy link
Member

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.

sagikazarmark added a commit that referenced this pull request Oct 22, 2015
@sagikazarmark sagikazarmark merged commit 7ba30ce into php-http:master Oct 22, 2015
@sagikazarmark
Copy link
Member

Thank you @joelwurtz

@joelwurtz joelwurtz deleted the feature/body-and-options-remove branch November 8, 2015 15:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants