<commit_before><?php
/**
 * Data class for AJAX loader.
 * Call method associated with $action, from context associated with $type.
 * 
 * @package stalker_portal
 * @author <EMAIL>
 */
 
class DataLoader
{
    
    private $type;
    private $action;
    private $context;
    private $method;
    
    public function __construct($type, $action){
        
        $this->type   = $type;
        $this->action = $action;
        
        try {
            $this->context = $this->getContext();
            $this->method  = $this->getMethod();
            
        }catch (Exception $e){
            trigger_error($e->getMessage());
        }
    }
    
    public function getResult(){
        
        try {
            $result = call_user_func(array($this->context, $this->method));
            return $result;
        
        }catch (Exception $e){
            trigger_error($e->getMessage());
        }
    }
    
    private function getContext(){
     
        $class = implode(array_map(function($part){
            return ucfirst($part);
        },explode('_', $this->type)));
        
        if (!class_exists($class)){
            throw new Exception('Class "'.$class.'" not exist');
        }
        <commit_msg>Modified error handling<commit_after><?php
/**
 * Data class for AJAX loader.
 * Call method associated with $action, from context associated with $type.
 * 
 * @package stalker_portal
 * @author <EMAIL>
 */
 
class DataLoader
{
    
    private $type;
    private $action;
    private $context;
    private $method;
    
    public function __construct($type, $action){
        
        $this->type   = $type;
        $this->action = $action;
        
        try {
            $this->context = $this->getContext();
            $this->method  = $this->getMethod();
            
        }catch (Exception $e){
            trigger_error($e->getTraceAsString());
        }
    }
    
    public function getResult(){
        
        try {
            $result = call_user_func(array($this->context, $this->method));
            return $result;
        
        }catch (Exception $e){
            trigger_error($e->getTraceAsString());
        }
    }
    
    private function getContext(){
     
        $class = implode(array_map(function($part){
            return ucfirst($part);
        },explode('_', $this->type)));
        
        if (!class_exists($class)){
            throw new Exception('Class "'.$class.'" not exist');
        }
        
{'fraction_non_alphanumeric': 0.13731825525040386, 'fraction_numerical': 0.0, 'mean_word_length': 1.7614269788182833, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 27, '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': '4772395', 'n_tokens_mistral': 685, 'n_tokens_neox': 686, 'n_words': 156}