<commit_before><?php
/*
 * This file is part of the prooph/common.
 * (c) 2014-2015 prooph software GmbH <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 * 
 * Date: 3/5/15 - 7:18 PM
 */
namespace Prooph\Common\Event\ZF2;

use Prooph\Common\Event\ActionEvent;
use Prooph\Common\Event\ActionEventDispatcher;
use Prooph\Common\Event\ActionEventListener;
use Prooph\Common\Event\ActionEventListenerAggregate;
use Prooph\Common\Event\ListenerHandler;
use Zend\EventManager\EventManager;

/**
 * Class Zf2ActionEventDispatcher
 *
 * @package Prooph\Common\Event\ZF2
 * @author <NAME> <<EMAIL>>
 */
class Zf2ActionEventDispatcher extends EventManager implements ActionEventDispatcher
{
    /**
     * @param ActionEvent $event
     * @return void
     */
    public function dispatch(ActionEvent $event)
    {
        if (! $event instanceof Zf2ActionEvent) {
            $event = $this->toZf2Event($event);
        }

        parent::trigger($event);
    }

    /**
     * @param ActionEvent $event
     * @param callable|object|string $callback
     * @return void
     */
    public function dispatchUntil(ActionEvent $event, $callback)
    {
        if (! $event instanceof Zf2ActionEvent) {
            $event = $this->toZf2Event($event);
        }

        parent::triggerUntil($event, function() use ($event, $callback) {
            return $callback($event);
        });
    }

    /**
     * Attach a listener to an event
     *
     * @param  string $event
     * @param  callable|ActionEventListener $listener
     * @param  int $priority Priority at which to register listener
     * @return ListenerHandler
     */
    public function attachListener($event, $listener, $priority = 1)
    {<commit_msg>Align trigger until with ZF2 2.4<commit_after><?php
/*
 * This file is part of the prooph/common.
 * (c) 2014-2015 prooph software GmbH <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 * 
 * Date: 3/5/15 - 7:18 PM
 */
namespace Prooph\Common\Event\ZF2;

use Prooph\Common\Event\ActionEvent;
use Prooph\Common\Event\ActionEventDispatcher;
use Prooph\Common\Event\ActionEventListener;
use Prooph\Common\Event\ActionEventListenerAggregate;
use Prooph\Common\Event\ListenerHandler;
use Zend\EventManager\EventManager;

/**
 * Class Zf2ActionEventDispatcher
 *
 * @package Prooph\Common\Event\ZF2
 * @author <NAME> <<EMAIL>>
 */
class Zf2ActionEventDispatcher extends EventManager implements ActionEventDispatcher
{
    /**
     * @param ActionEvent $event
     * @return void
     */
    public function dispatch(ActionEvent $event)
    {
        if (! $event instanceof Zf2ActionEvent) {
            $event = $this->toZf2Event($event);
        }

        parent::trigger($event);
    }

    /**
     * @param ActionEvent $event
     * @param callable|object|string $callback
     * @return void
     */
    public function dispatchUntil(ActionEvent $event, $callback)
    {
        if (! $event instanceof Zf2ActionEvent) {
            $event = $this->toZf2Event($event);
        }

        parent::trigger($event, function() use ($event, $callback) {
            return $callback($event);
        });
    }

    /**
     * Attach a listener to an event
     *
     * @param  string $event
     * @param  callable|ActionEventListener $listener
     * @param  int $priority Priority at which to register listener
     * @return ListenerHandler
     */
    public function attachListener($event, $listener, $priority = 1)
    {
{'fraction_non_alphanumeric': 0.11206419479800775, 'fraction_numerical': 0.014111787493082457, 'mean_word_length': 2.942202835332606, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, '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': '1448221', 'n_tokens_mistral': 1082, 'n_tokens_neox': 1034, 'n_words': 275}