<commit_before><?php
/**
 * @version     $Id$
 * @category	Koowa
 * @package     Koowa_Mixin
 * @copyright   Copyright (C) 2007 - 2010 <NAME>. All rights reserved.
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.nooku.org
 */

/**
 * Command Mixin
 * 
 * Class can be used as a mixin in classes that want to implement a chain 
 * of responsability or chain of command pattern.
 *  
 * @author      <NAME> <<EMAIL>>
 * @category    Koowa
 * @package     Koowa_Mixin
 * @uses        KCommandChain
 * @uses        KCommandInterface
 * @uses        KCommandEvent
 */
class KMixinCommand extends KMixinAbstract
{   
    /**
     * Chain of command object
     *
     * @var KCommandChain
     */
    protected $_command_chain;
    
    /**
     * Object constructor
     *
     * @param   object  An optional KConfig object with configuration options
     */
    public function __construct(KConfig $config)
    {
        parent::__construct($config);
        
        if(is_null($config->command_chain)) {
			throw new KMixinException('command_chain [KCommandChain] option is required');
		}
            
        //Create a command chain object 
        $this->_command_chain = $config->command_chain;
        
        //Mixin the callback mixer if callbacks have been enabled
        if($config->enable_callbacks) 
        {
            $this->_mixer->mixin(new KMixinCallback(new KConfig(array(
                'mixer'             => $this->_mixer, 
                'command_chain'     => $this->_command_chain,
                'command_priority'  => $config->callback_priority
            ))));
        }
        
        //Enqueue the event command with a lowest priority to make sure it runs last
        if($config->dispatch_events) 
        { 
             $this->_mixer->mixin(new KMixinEvent(new KConfig(array(
                'mixer'             => $this->_mixer, 
                'event_dispatcher'  => $config->event_dispatcher
            ))));
            
            //@TODO : Add KCommandChain::getCommand()     
            $event = $this->_command_chain->getService('koowa:command.event', array(
            	'event_dispatcher' => $config->event_dispatcher
            ));<commit_msg>Code cleanup<commit_after><?php
/**
 * @version     $Id$
 * @category	Koowa
 * @package     Koowa_Mixin
 * @copyright   Copyright (C) 2007 - 2010 <NAME>. All rights reserved.
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.nooku.org
 */

/**
 * Command Mixin
 * 
 * Class can be used as a mixin in classes that want to implement a chain 
 * of responsability or chain of command pattern.
 *  
 * @author      <NAME> <<EMAIL>>
 * @category    Koowa
 * @package     Koowa_Mixin
 * @uses        KCommandChain
 * @uses        KCommandInterface
 * @uses        KCommandEvent
 */
class KMixinCommand extends KMixinAbstract
{   
    /**
     * Chain of command object
     *
     * @var KCommandChain
     */
    protected $_command_chain;
    
    /**
     * Object constructor
     *
     * @param   object  An optional KConfig object with configuration options
     */
    public function __construct(KConfig $config)
    {
        parent::__construct($config);
        
        if(is_null($config->command_chain)) {
			throw new KMixinException('command_chain [KCommandChain] option is required');
		}
            
        //Create a command chain object 
        $this->_command_chain = $config->command_chain;
        
        //Set the mixer in the config
        $config->mixer = $this->_mixer;
        
        //Mixin the callback mixer if callbacks have been enabled
        if($config->enable_callbacks) {
            $this->_mixer->mixin(new KMixinCallback($config));
        }
        
        //Enqueue the event command with a lowest priority to make sure it runs last
        if($config->dispatch_events) 
        { 
            $this->_mixer->mixin(new KMixinEvent($config));
            
            //@TODO : Add KCommandChain::getCommand()     
            $event = $this->_command_chain->getService('koowa:command.event', array(
            	'event_dispatcher' => $config->event_dispatcher
            ));
{'fraction_non_alphanumeric': 0.10934157356786309, 'fraction_numerical': 0.004278583313525077, 'mean_word_length': 2.0100143061516453, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '2541776', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1174, 'n_words': 299}