Created
July 9, 2015 23:08
-
-
Save nch7/05fb8d5dd44acb69cf6b to your computer and use it in GitHub Desktop.
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 | |
trait GatewayTrait { | |
public function __call($name, $arguments) { | |
call_user_func_array([$this->repo, $name], $arguments); | |
} | |
} | |
class Gateway { | |
use GatewayTrait; | |
public function __construct() { | |
$this->repo = new Repo; | |
} | |
} | |
class Repo { | |
public function save($id, $arguments) { | |
var_dump($arguments); | |
} | |
} | |
$gateway = new Gateway; | |
$gateway->save(13,['foo'=>'bar']); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment