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.
Updated for phpunit 4.0
Merge pull request #3581 from colindecarlo/refactor-http-request

[Refactor] Small changes to Http\Request
Check path in method hasFile.

This pull-request solves a problem encountered when uploading a "corrupt" file like one of the files you can found at http://www.thinkbroadband.com/download.html.

Any of these files is considered empty in the validation (I am checking that a image is uploaded), therefore these pass validation. However, in the controller, when I try to save the image I check if Input has the file and this returned true.

This commit solves this problem. Previously a corrupt file passed the validation because is considered empty and is not required, but was not considered empty by the method Input::hasFile().
Merge pull request #3818 from GrahamCampbell/4.1-phpunit

[4.1] PHPUnit 4.0
Merge pull request #3815 from rporrasluc/4.1

Check path in method hasFile.
Fix bug and add regression test
put jsonOptions back in
Merge 4.1.