<commit_before><?php

/*
 * This file is part of the PEIP package.
 * (c) 2010 <NAME> <timomichna/yahoo.de>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 * PEIP_Callable_Handler 
 *
 * @author <NAME> <timomichna/yahoo.de>
 * @package PEIP 
 * @subpackage event 
 * @implements PEIP_INF_Handler
 */

class PEIP_Callable_Handler 
	implements PEIP_INF_Handler {

    protected $callable;
    
    /**
     * @access public
     * @param $callable 
     * @return 
     */
    public function __construct($callable){
        $this->callable = $callable;    
    }
        
    /**
     * @access public
     * @param $subject 
     * @return 
     */
    public function handle($subject){
        return call_user_func($this->callable, $subject);
    }
    
    /**
     * @access public
     * @param $subject 
     * @return 
     */
    public function __invoke($subject){
        return $this->handle($subject); 
    }
    
    /**
     * @access public
     * @return 
     */
    public function getCallable(){
        return $this->callable;
    }
    
}<commit_msg>[PEIP_Callable_Handler] extended inline documentation<commit_after><?php

/*
 * This file is part of the PEIP package.
 * (c) 2010 <NAME> <timomichna/yahoo.de>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 * PEIP_Callable_Handler 
 * Class to wrap a PHP callable in a handler
 *
 * @author <NAME> <timomichna/yahoo.de>
 * @package PEIP 
 * @subpackage event 
 * @implements PEIP_INF_Handler
 */

class PEIP_Callable_Handler 
	implements PEIP_INF_Handler {

    protected $callable;
    
    /**
     * constructor
     * 
     * @access public
     * @param callable $callable the callable to wrap with the handler 
     * @return 
     */
    public function __construct($callable){
        $this->callable = $callable;    
    }
        
    /**
     * Handles a subject by calling the wrapped callable with the subject as argument.
     * 
     * @implements PEIP_INF_Handler
     * @access public
     * @param mixed $subject the subject to handle
     * @return mixed result of calling the registered callable with given subject
     */
    public function handle($subject){
        return call_user_func($this->callable, $subject);
    }
    
    /**
     * Allows the handler instance to act as a lambda function.
     * Delegates to own 'handle' method.
     * 
     * @access public
     * @param mixed $subject the subject to handle
     * @return mixed result of calling the registered callable with given subject
     * @see PEIP_Callable_Handler::handle 
     */
    public function __invoke($subject){
        return $this->handle($subject); 
    }
    
    /**
     * Returns the callable wrapped by the handler instance.
     * 
     * @access public
     * @return callable callable wrapped by the handler
     */
    public function getCallable(){
        return $this->callable;
    }
    
}
{'fraction_non_alphanumeric': 0.09840338872596938, 'fraction_numerical': 0.002606712284131639, 'mean_word_length': 2.358862144420131, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, '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': '6255267', 'n_tokens_mistral': 929, 'n_tokens_neox': 883, 'n_words': 271}