1 | <?php |
||
8 | class UriParameters |
||
9 | { |
||
10 | /** |
||
11 | * Replace route parameters. |
||
12 | * |
||
13 | * @param $uri |
||
14 | * @param array $parameters |
||
15 | * @return mixed|string |
||
16 | */ |
||
17 | 7 | public static function replace($uri, $parameters = []) |
|
26 | |||
27 | /** |
||
28 | * Replace all of the wildcard parameters for a route path. |
||
29 | * |
||
30 | * @note: based on the Illuminate\Routing\UrlGenerator code |
||
31 | * |
||
32 | * @param string $path |
||
33 | * @param array $parameters |
||
34 | * |
||
35 | * @return string |
||
36 | */ |
||
37 | 7 | private static function replaceRouteParameters($path, array $parameters) |
|
49 | |||
50 | /** |
||
51 | * Replace all of the named parameters in the path. |
||
52 | * |
||
53 | * @note: based on the Illuminate\Routing\UrlGenerator code |
||
54 | * |
||
55 | * @param string $path |
||
56 | * @param array $parameters |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | private static function replaceNamedParameters($path, &$parameters) |
||
66 | } |
Let’s assume you have a class which uses late-static binding:
}
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: