1 | <?php |
||
24 | class RouterPathTransformer extends AbstractLocationTransformer implements |
||
25 | LocationTransformerInterface |
||
26 | { |
||
27 | |||
28 | /** |
||
29 | * @var RouterContainer |
||
30 | */ |
||
31 | private $router; |
||
32 | |||
33 | /** |
||
34 | * Router Path Transformer |
||
35 | * |
||
36 | * @param RouterContainer $router |
||
37 | */ |
||
38 | public function __construct(RouterContainer $router) |
||
42 | |||
43 | /** |
||
44 | * Tries to transform the provided location data into a server URI |
||
45 | * |
||
46 | * @param string $location Location name, path or identifier |
||
47 | * @param array $options Filter options |
||
48 | * |
||
49 | * @return UriInterface|null |
||
50 | */ |
||
51 | public function transform($location, array $options = []) |
||
65 | |||
66 | /** |
||
67 | * Get the route arguments from provided options |
||
68 | * |
||
69 | * For options that match the default options those will |
||
70 | * override the default value. |
||
71 | * |
||
72 | * @param array $options |
||
73 | * |
||
74 | * @return array |
||
75 | */ |
||
76 | private function getRouteArguments(array $options = []) |
||
88 | } |
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
.