Move some cases to separate test
Use built-in exception matcher
Refactor uri(), refs #4630

Uses preg_replace_callback to process each group and key at one level
exactly once. Recursively processes groups depth-first to detect
specified parameters before deciding to include the group in the result.
try to clean up coding standards a bit
Merge pull request #315 from kohana/3.3/feature/4630-uri-optional-params

Build URI using preg_replace_callback
refs #4630