From 01bc363ac789cfb9d644ce82a949da5cd7e1c220 Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 31 Jan 2006 00:01:49 +0000 Subject: Modified TList and TMap implementation so that they can be more easily extended. --- framework/Security/TAuthorizationRule.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'framework/Security') diff --git a/framework/Security/TAuthorizationRule.php b/framework/Security/TAuthorizationRule.php index 2ee6de49..81955a44 100644 --- a/framework/Security/TAuthorizationRule.php +++ b/framework/Security/TAuthorizationRule.php @@ -200,13 +200,19 @@ class TAuthorizationRuleCollection extends TList } /** - * Ensures that only instance of TAuthorizationRule is added to the collection. - * @param mixed item to be added to the collection - * @return boolean whether the item can be added to the collection - */ - protected function canAddItem($item) + * Inserts an item at the specified position. + * This overrides the parent implementation by performing additional + * operations for each newly added TAuthorizationRule object. + * @param integer the speicified position. + * @param mixed new item + * @throws TInvalidDataTypeException if the item to be inserted is not a TAuthorizationRule object. + */ + public function insertAt($index,$item) { - return ($item instanceof TAuthorizationRule); + if($item instanceof TAuthorizationRule) + parent::insertAt($index,$item); + else + throw new TInvalidDataTypeException('authorizationrulecollection_authorizationrule_required'); } } -- cgit v1.2.3