たとえば、Zend_Acl_Assert_Interface から派生したクラスに assert メソッドを実装しています。
function assert(
Zend_Acl $acl,
Zend_Acl_Role_Interface $user = null,
Zend_Acl_Resource_Interface $item = null,
$privilege = null
) {
if (!$user instanceof User) throw new Exception("…");
if (!$item instanceof Item) throw new Exception("…");
return
$user->money >= $item->price &&
$user->rating >= $item->requiredRating;
}
ユーザーが十分なお金を持っていることと、ユーザーが十分な評価を持っていることの 2 つの条件をチェックします。isAllowed メソッドが bool のみを返すときにどの条件が失敗したかをユーザーに知らせるエラー メッセージを表示する方法は?