<commit_before><?php

class BaseEvent {

    private $events=Array();
    private $actions=Array();

    public final function listen($event,$action){
        $events[]=$event;
        $actions[]=$action;
    }//listen

    public final function fire($event,$data){
        $events = array_intersect_key(Array($event),$this->events);
        if(count($events)>0){

            var_dump($events);

            //if($instance instanceof Closure){
            //    $instance=call_user_func($instance);
            //}//if

            //return Disco::handle($instance,$method,$args);

        }//if
    }//fire

}//BaseEvent


?>
<commit_msg>completed fire()<commit_after><?php

class BaseEvent {

    private $events=Array();

    public final function listen($event,$action,$priority=0){
        if(!isset($this->events[$event])){
            $this->events[$event]=Array('actions'=>Array());
        }//if

        $this->events[$event]['actions'][$priority]=$action;

    }//listen

    public final function fire($event,$data=null){

        if(count(array_intersect_key(Array($event=>Array()),$this->events))>0){

            $keys = array_keys($this->events[$event]['actions']);

            if(count($keys)>1)
                $keys = ksort($keys);

            foreach($keys as $k){
                $action = $this->events[$event]['actions'][$k];
                if($action instanceof Closure){
                    call_user_func($action);
                }//if
                else {
                    $method='work';
                    if(stripos($action,'@')!==false){
                        $method = explode('@',$action);
                        $action = $method[0];
                        $method = $method[1];
                    }//if
                    $instance = new $action();
                    Disco::handle($instance,$method,$data);
                }//el
            }//foreach

        }//if
        else 
            TRIGGER_ERROR('Event:: Event not found '.$event,E_USER_WARNING);
    }//fire

}//BaseEvent


?>

{'fraction_non_alphanumeric': 0.17229564366128242, 'fraction_numerical': 0.002936857562408223, 'mean_word_length': 1.7923497267759563, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3791925', 'n_tokens_mistral': 581, 'n_tokens_neox': 543, 'n_words': 92}