Skip to content

Instantly share code, notes, and snippets.

@ajuchacko
Last active March 11, 2019 18:08
Show Gist options
  • Save ajuchacko/feeb5023ccc025d240bae85182a580df to your computer and use it in GitHub Desktop.
Save ajuchacko/feeb5023ccc025d240bae85182a580df to your computer and use it in GitHub Desktop.
Class User {
public function listAll() {
// This method is used on many classes.eg: Member class
}
}
class Member {
private $user;
private function user() {
if(! $this->user) {
$this->user = new User;
}
return $this->user;
}
public function list() {
return $this->user()->listAll();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment