<commit_before><?php
namespace M6Web\Bundle\CassandraBundle\Cassandra;

use Cassandra\Future;
use M6Web\Bundle\CassandraBundle\EventDispatcher\CassandraEvent;

/**
 * Class FutureResponse
 *
 * Handle future response for dispatching event when request is complete
 */
class FutureResponse implements Future
{
    /**
     * @var EventDispatcher
     */
    protected $eventDispatcher;

    /**
     * @var CassandraEvent
     */
    protected $event;

    /**
     * @var Futurer
     */
    protected $future;

    /**
     * @param Future          $future
     * @param CassandraEvent  $event
     * @param EventDispatcher $eventDispatcher
     */
    public function __construct(Future $future, CassandraEvent $event, $eventDispatcher)
    {
        $this->future          = $future;
        $this->event           = $event;
        $this->eventDispatcher = $eventDispatcher;
    }

    /**
     * Waits for a given future resource to resolve and throws errors if any.
     *
     * @param int|null $timeout
     *
     * @throws \Cassandra\Exception\InvalidArgumentException
     * @throws \Cassandra\Exception\TimeoutException
     *
     * @return mixed a value that the future has been resolved with
     */
    public function get($timeout = null)
    {
        $return = $this->future->get($timeout);

        $this->event->setExecutionStop();
        $this->eventDispatcher->dispatch('m6web.cassandra', $this->event);

        return $return;
    }
}<commit_msg>Add a future repsonse class for handle dispatcher for asynchronous command<commit_after><?php
namespace M6Web\Bundle\CassandraBundle\Cassandra;

use Cassandra\Future;
use M6Web\Bundle\CassandraBundle\EventDispatcher\CassandraEvent;

/**
 * Class FutureResponse
 *
 * Handle future response for dispatching event when request is complete
 */
class FutureResponse implements Future
{
    /**
     * @var EventDispatcher
     */
    protected $eventDispatcher;

    /**
     * @var CassandraEvent
     */
    protected $event;

    /**
     * @var Futurer
     */
    protected $future;

    /**
     * @param Future          $future
     * @param CassandraEvent  $event
     * @param EventDispatcher $eventDispatcher
     */
    public function __construct(Future $future, CassandraEvent $event, $eventDispatcher)
    {
        $this->future          = $future;
        $this->event           = $event;
        $this->eventDispatcher = $eventDispatcher;
    }

    /**
     * Waits for a given future resource to resolve and throws errors if any.
     *
     * @param int|null $timeout
     *
     * @throws \Cassandra\Exception\InvalidArgumentException
     * @throws \Cassandra\Exception\TimeoutException
     *
     * @return mixed a value that the future has been resolved with
     */
    public function get($timeout = null)
    {
        $return = $this->future->get($timeout);

        $this->event->setExecutionStop();
        $this->eventDispatcher->dispatch(CassandraEvent::EVENT_NAME, $this->event);

        return $return;
    }
}
{'fraction_non_alphanumeric': 0.10716655607166556, 'fraction_numerical': 0.0016589250165892503, 'mean_word_length': 2.513986013986014, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '7298456', 'n_tokens_mistral': 853, 'n_tokens_neox': 805, 'n_words': 208}