Squashed commits of general refactoring to the segments method.

* Refactor segments method so that it is consitent with the expected values of the segment method
* DRY out the segment method so that it uses the segments method
* Add braces to control structures with a single line
* PSR 2 requires that:

  > The body of each structure MUST be enclosed by braces

  Throw caution to the wind and remove braces from control structures containg a single line

* Revert "Add braces to control structures with a single line"

  This reverts commit 8e56540a4301ede193d3743313487d9f77b457a0.
Merge pull request #3581 from colindecarlo/refactor-http-request

[Refactor] Small changes to Http\Request