I have seen this example in frameworks like silex, symfony and I am not sure how it is done.
basically, I would like to get the content id Request
without instantiating it hiding the instantiation part and simply call the class via a functions argument.
Here is a basic example.
<?php
class Request {
function get($key){
$_GET[$key] = 42;
return $_GET[$key];
}
}
$route = function(Request $request){
// how to '42' without instanciating Request here
var_dump($request->get('..'));
};
var_dump($route);