/** * Allows checking of user roles. * * <code> * if (Model_User::is_admin()) { * echo "You are an admin"; * } * </code> * * @see {@link \Warden\Warden::has_access} */ public function __call($method, $args) { $convenience = substr($method, 0, 3); $role = substr($method, 4); if ($convenience == 'is_') { return Warden::has_access($role, $this); } throw new \BadMethodCallException("Call to undefined method Model_User::{$method}()"); }