1 | <?php |
||
16 | class UriFactory implements Factory |
||
17 | { |
||
18 | /** |
||
19 | * Create instances of Uri object from instance of Environment object |
||
20 | * |
||
21 | * @param Environment $environment environment data |
||
22 | * |
||
23 | * @return Uri Instance of Uri object created from environment |
||
24 | */ |
||
25 | 2 | public function create(Environment $environment) |
|
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
.