Last active
November 21, 2017 05:13
-
-
Save jagroop/180d42a6752de3624bf3678188a19f0f to your computer and use it in GitHub Desktop.
Method Overriding Advance Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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