<commit_before><?php
/**
 * @version     $Id: mysqli.php 3702 2011-07-18 21:55:44Z johanjanssens $
 * @category	Nooku
 * @package     Nooku_Components
 * @subpackage  Default
 * @copyright   Copyright (C) 2007 - 2010 <NAME>. All rights reserved.
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.nooku.org
 */


/**
 * Default Event Dispatcher
.*
 * @author      <NAME> <<EMAIL>>
 * @category    Nooku
 * @package     Nooku_Components
 * @subpackage  Default
 */
class ComDefaultEventDispatcher extends KEventDispatcher implements KObjectInstantiatable
{
 	/**
     * Force creation of a singleton
     *
     * @param 	object	An optional KConfig object with configuration options
     * @param 	object	A KFactoryInterface object
     * @return ComDefaultEventDispatcher
     */
    public static function getInstance(KConfigInterface $config, KFactoryInterface $factory)
    { 
       // Check if an instance with this identifier already exists or not
        if (!$factory->exists($config->identifier))
        {
            //Create the singleton
            $classname = $config->identifier->classname;
            $instance  = new $classname($config);
            $factory->set($config->identifier, $instance);
            
            //Add the factory map to allow easy access to the singleton
            KIdentifier::map('koowa:event.dispatcher', $config->identifier);
        }
        
        return $factory->get($config->identifier);
    }
}<commit_msg>re #135 : Renamed KFactory::exists() to KFactory::has()<commit_after><?php
/**
 * @version     $Id: mysqli.php 3702 2011-07-18 21:55:44Z johanjanssens $
 * @category	Nooku
 * @package     Nooku_Components
 * @subpackage  Default
 * @copyright   Copyright (C) 2007 - 2010 <NAME>. All rights reserved.
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.nooku.org
 */


/**
 * Default Event Dispatcher
.*
 * @author      <NAME> <<EMAIL>>
 * @category    Nooku
 * @package     Nooku_Components
 * @subpackage  Default
 */
class ComDefaultEventDispatcher extends KEventDispatcher implements KObjectInstantiatable
{
 	/**
     * Force creation of a singleton
     *
     * @param 	object	An optional KConfig object with configuration options
     * @param 	object	A KFactoryInterface object
     * @return ComDefaultEventDispatcher
     */
    public static function getInstance(KConfigInterface $config, KFactoryInterface $factory)
    { 
       // Check if an instance with this identifier already exists or not
        if (!$factory->has($config->identifier))
        {
            //Create the singleton
            $classname = $config->identifier->classname;
            $instance  = new $classname($config);
            $factory->set($config->identifier, $instance);
            
            //Add the factory map to allow easy access to the singleton
            KIdentifier::setAlias('koowa:event.dispatcher', $config->identifier);
        }
        
        return $factory->get($config->identifier);
    }
}
{'fraction_non_alphanumeric': 0.11103853690398433, 'fraction_numerical': 0.018615284128020902, 'mean_word_length': 2.6248520710059173, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 31, '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': '6271322', 'n_tokens_mistral': 908, 'n_tokens_neox': 840, 'n_words': 231}