Skip to content

Instantly share code, notes, and snippets.

@bocharsky-bw
Last active April 14, 2017 00:19
Show Gist options
  • Save bocharsky-bw/9484863 to your computer and use it in GitHub Desktop.
Save bocharsky-bw/9484863 to your computer and use it in GitHub Desktop.
Automatic call getter and isser methods
<?php
public function __call($method, $arguments) {
if ( method_exists($this->lang, $method) ) {
return call_user_func_array(array($this->lang, $method), $arguments);
}
$getter = 'get'. ucfirst($method);
if ( method_exists($this->lang, $getter) ) {
return call_user_func_array(array($this->lang, $getter), $arguments);
}
$isser = 'is'. ucfirst($method);
if ( method_exists($this->lang, $isser) ) {
return call_user_func_array(array($this->lang, $isser), $arguments);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment