Skip to content

Instantly share code, notes, and snippets.

@jagroop
Last active November 21, 2017 05:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jagroop/180d42a6752de3624bf3678188a19f0f to your computer and use it in GitHub Desktop.
Save jagroop/180d42a6752de3624bf3678188a19f0f to your computer and use it in GitHub Desktop.
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