Simplify conditions in isValid()

- `! isset($array['key']) || empty($array['key'])` is redundant; latter
  condition covers both cases.
Extracted URI creation logic from fromArray()

- Created several new methods:
  - isNonStandardPort(), to simplify a conditional
  - normalizePath(), to remove code duplication
  - createUriString(), for creating a URI string from the various parts
    that make one up
- setPath() and fromArray() now each use createUriString().
Simplify parseUri()

By using isNonStandardPort() when determining how to set the domain
property.
CS fixes (trailing whitespace)
Merge branch 'hotfix/uri-refactor'

Refactors based on scrutinizer-ci feedback, intended to improve maintainability
and readability of the Uri class.