Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?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']);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement