Skip to content

Instantly share code, notes, and snippets.

@jagroop jagroop/Request.php
Last active Nov 21, 2017

Embed
What would you like to do?
Method Overriding Advance Example
<?php
class Request
{
public static function __callStatic($method, $args)
{
return RequestHandler::new()->{$method}(...$args);
}
}
class RequestHandler {
public static function new(...$args)
{
return new self(...$args);
}
public static function post($foo, $bar)
{
return $foo . " " . $bar;
}
}
echo Request::post('Its', 'Awesome !!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.