Lines
76.19%
16 / 21
Methods
0.00%
0 / 1
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 76.19% | 16 / 21 | 0.00% | 0 / 1 | 3.12 | ||
| 10 | class Uri extends \Slim\Psr7\Uri implements \Psr\Http\Message\UriInterface | |
| 11 | { | |
| 12 | public function __construct( | |
| 13 | string $schemeOrUri = '', | |
| 14 | ?string $host = null, | |
| 15 | ?int $port = null, | |
| 16 | string $path = '/', | |
| 17 | string $query = '', | |
| 18 | string $fragment = '', | |
| 19 | string $user = '', | |
| 20 | string $password = '' | |
| 21 | ) { | |
| 22 | if ($host !== null) { | |
| 23 | parent::__construct($schemeOrUri, $host, $port, $path, $query, $fragment, $user, $password); | |
| 24 | return; | |
| 25 | } | |
| 26 | ||
| 27 | $temp = (new UriFactory())->createUri($schemeOrUri); | |
| 28 | $userInfo = $temp->getUserInfo(); | |
| 29 | $parsedUser = ''; | |
| 30 | $parsedPassword = ''; | |
| 31 | if ($userInfo !== '') { | |
| 32 | $parts = explode(':', $userInfo, 2); | |
| 33 | $parsedUser = $parts[0]; | |
| 34 | $parsedPassword = $parts[1] ?? ''; | |
| 35 | } | |
| 36 | parent::__construct( | |
| 37 | $temp->getScheme(), | |
| 38 | $temp->getHost(), | |
| 39 | $temp->getPort(), | |
| 40 | $temp->getPath(), | |
| 41 | $temp->getQuery(), | |
| 42 | $temp->getFragment(), | |
| 43 | $parsedUser, | |
| 44 | $parsedPassword | |
| 45 | ); | |
| 46 | } | |
| 47 | } |