/** * @return Acl */ public static function instance() { if (self::$_instance === null) { self::$_instance = new Acl(); } return self::$_instance; }
public static function getInstance() { if (is_null(self::$_instance) || !isset(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; }
/** * init instance * order rights object to set roles ,resources, allow, deny * $identity must have $identity->id and $identity->role * * $rights must have methods: * set_roles * set_resources * set_allow * set_deny * * @param Identity $identity * @param Rights $rights * @return Acl */ public static function init($identity, $rights) { // create instance if (self::$_instance == false) { self::$_instance = new Acl($identity, $rights); } // return data return self::$_instance; }