+
+ public static function bind($bot, $type, $method, $filter = NULL) {
+ if(is_a($bot, "Bot") && method_exists($bot, $method)) {
+ if(array_key_exists($type, self::$bindings)) {
+ foreach(self::$bindings[$type] as $binding) {
+ if($binding->match($bot, $method, $filter))
+ return;
+ }
+ } else
+ self::$bindings[$type] = array();
+ self::$bindings[$type][] = new Binding($bot, $method, $filter);
+ }
+ }
+
+ public static function unbind($bot, $type, $method, $filter = NULL) {
+ if(is_a($bot, "Bot")) {
+ if(array_key_exists($type, self::$bindings)) {
+ foreach(self::$bindings[$type] as $id => $binding) {
+ if($binding->match($bot, $method, $filter)) {
+ unset(self::$bindings[$type][$id]);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ public static function unbindBot($bot) {
+ if(is_a($bot, "Bot")) {
+ foreach(self::$bindings as $type => $bindings) {
+ foreach($bindings as $id => $binding) {
+ if($binding->match($bot, null, null)) {
+ unset(self::$bindings[$type][$id]);
+ }
+ }
+ }
+ }
+ }
+