Conditions | 1 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
25 | 2 | public function create(Environment $environment) |
|
26 | { |
||
27 | 2 | $scheme = $environment->getRequestScheme(); |
|
28 | 2 | $host = $environment->getHost(); |
|
29 | 2 | $port = $environment->getPort(); |
|
30 | |||
31 | 2 | $path = parse_url('http://example.com' . $environment->getRequestUri(), PHP_URL_PATH); |
|
32 | 2 | $query = $environment->getQueryString(); |
|
33 | 2 | $user = $environment->getAuthUser(); |
|
34 | 2 | $pass = $environment->getAuthPassword(); |
|
35 | |||
36 | 2 | return new Uri($scheme, $host, $port, $path, $query, '', $user, $pass); |
|
|
|||
37 | } |
||
38 | } |
||
39 |
This check looks for type mismatches where the missing type is
false
. This is usually indicative of an error condtion.Consider the follow example
This function either returns a new
DateTime
object or false, if there was an error. This is a typical pattern in PHP programming to show that an error has occurred without raising an exception. The calling code should check for this returnedfalse
before passing on the value to another function or method that may not be able to handle afalse
.