<commit_before><?php
namespace ValuSo\Command;

use ValuSo\Exception;
use Zend\EventManager\EventManager;
use Zend\EventManager\ResponseCollection;
use Zend\EventManager\EventInterface;
use Valu\Service\Exception;

/**
 * Command manager is responsible of maintaining list of subscribed
 * command listeners and dispatching commands to correct listeners
 * 
 * This class extends {@see \Zend\EventManager\EventManager} but does
 * not support all its features. This class is inteded to be used
 * only via {@see \ValuSo\Broker\ServiceBroker} and {@see \ValuSo\Broker\ServiceLoader} classes.
 * 
 * @author juhasuni
 */
class CommandManager extends EventManager
{
    /**
     * Triggers listeners for specific command
     * 
     * @see \Zend\EventManager\EventManager::triggerListeners()
     */
    protected function triggerListeners($command, CommandInterface $c, $callback = null)
    {
        $responses = new ResponseCollection();
        $listeners = $this->getListeners($command);
        
        $command->setResponses($responses);
        
        if ($listeners->isEmpty()) {
            return $responses;
        }
        
        $exception = null;
        
        foreach ($listeners as $listener) {
            
            try{
                $response  = call_user_func($listener->getCallback(), $command);
                $exception = null;
            } catch(Exception\SkippableException $ex) {
                
                if (!$exception) {
                    $exception = $ex;
                }
                
                if ($c->propagationIsStopped()) {
                    $responses->setStopped(true);
                    break;
                } else {
                    continue;
                }<commit_msg>Fixed method signature and defined correct default event class name<commit_after><?php
namespace ValuSo\Command;

use ValuSo\Exception;
use Zend\EventManager\EventManager;
use Zend\EventManager\ResponseCollection;
use Zend\EventManager\EventInterface;

/**
 * Command manager is responsible of maintaining list of subscribed
 * command listeners and dispatching commands to correct listeners
 * 
 * This class extends {@see \Zend\EventManager\EventManager} but does
 * not support all its features. This class is inteded to be used
 * only via {@see \ValuSo\Broker\ServiceBroker} and {@see \ValuSo\Broker\ServiceLoader} classes.
 * 
 * @author juhasuni
 */
class CommandManager extends EventManager
{
    
    protected $eventClass = 'ValuSo\Command\Command';
    
    /**
     * Triggers listeners for specific command
     * 
     * @see \Zend\EventManager\EventManager::triggerListeners()
     */
    protected function triggerListeners($event, EventInterface $e, $callback = null)
    {
        $command = $event;
        $c = $e;
        
        $responses = new ResponseCollection();
        $listeners = $this->getListeners($command);
        
        $c->setResponses($responses);
        
        if ($listeners->isEmpty()) {
            return $responses;
        }
        
        $exception = null;
        
        foreach ($listeners as $listener) {
            
            try{
                $response  = call_user_func($listener->getCallback(), $c);
                $exception = null;
            } catch(Exception\SkippableException $ex) {
                
                if (!$exception) {
                    $exception = $ex;
                }
                
                if ($c->propagationIsStopped()) {
                    $responses->setStopped(true);
                    break;
                } else {
                    continue;
                }
{'fraction_non_alphanumeric': 0.09766803840877915, 'fraction_numerical': 0.0, 'mean_word_length': 1.9285140562248997, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '3208411', 'n_tokens_mistral': 943, 'n_tokens_neox': 919, 'n_words': 236}