<commit_before><?php

namespace SlmQueueDoctrine\Controller;

use Exception;
use SlmQueueDoctrine\Queue\Table;
use Zend\Mvc\Controller\AbstractActionController;

/**
 * Worker controller
 */
class WorkerController extends AbstractActionController
{
    /**
     * Process the queue
     *
     * @return string
     */
    public function processAction()
    {
        /** @var $worker \SlmQueueDoctrine\Worker\Worker */
        $worker    = $this->serviceLocator->get('SlmQueueDoctrine\Worker\Worker');
        $queueName = $this->params('queueName');
        $options   = array();

        try {
            $count = $worker->processQueue($queueName, array_filter($options));
        } catch(Exception $exception) {
            return "\nAn error occurred " . $exception->getMessage() . "\n\n";
        }

        return sprintf(
            "\nWork for queue %s is done, %s jobs were processed\n\n",
            $queueName,
            $count
        );
    }

    /**
     * Recover long running jobs
     *
     * @return string
     */
    public function recoverAction()
    {
        $queueName     = $this->params('queueName');
        $executionTime = $this->params('executionTime', 0);

        /** @var $queueManager \SlmQueue\Queue\QueuepluginManager */
        $queueManager = $this->getServiceLocator()->get('SlmQueue\Queue\QueuePluginManager');
        $queue        = $queueManager->get($queueName);

        if(!$queue instanceof Table) {
            return sprintf("\nQueue % does not support the recovering of job\n\n", $queueName);
        }

        try {
            $count = $queue->recover($executionTime);
        } catch(Exception $exception) {
            return "\nAn error occurred " . $exception->getMessage() . "\n\n";
        }

        return sprintf(
            "\nWork for queue %s is done, %s jobs were recovered\n\n",
            $queueName,
            $count
        );
    }<commit_msg>use abstract SlmQueue/Controller/AbstractController<commit_after><?php

namespace SlmQueueDoctrine\Controller;

use Exception;
use SlmQueueDoctrine\Queue\Table;
use SlmQueue\Controller\AbstractWorkerController;
use SlmQueue\Controller\Exception\WorkerProcessException;
use SlmQueue\Exception\SlmQueueExceptionInterface;

/**
 * Worker controller
 */
class WorkerController extends AbstractWorkerController
{

    /**
     * {@inheritDoc}
     */
    protected function getWorker() {
        /** @var $worker \SlmQueueDoctrine\Worker\Worker */
        $worker    = $this->serviceLocator->get('SlmQueueDoctrine\Worker\Worker');

        return $worker;
    }

    /**
     * {@inheritDoc}
     */
    protected function getOptions() {

    }

    /**
     * {@inheritDoc}
     */
    protected function getQueueName() {
        $queueName = $this->params('queueName');

        return $queueName;
    }

    /**
     * Recover long running jobs
     *
     * @return string
     */
    public function recoverAction()
    {
        $queueName     = $this->getQueueName();
        $executionTime = $this->params('executionTime', 0);

        /** @var $queueManager \SlmQueue\Queue\QueuepluginManager */
        $queueManager = $this->getServiceLocator()->get('SlmQueue\Queue\QueuePluginManager');
        $queue        = $queueManager->get($queueName);

        if(!$queue instanceof Table) {
            return sprintf("\nQueue % does not support the recovering of job\n\n", $queueName);
        }

        try {
            $count = $queue->recover($executionTime);
        } catch(\Exception $exception) {
            throw new \Exception("An error occurred", null, $exception);
        }

        return sprintf(
            "\nWork for queue %s is done, %s jobs were recovered\n\n",
            $queueName,
            $count
        );
    }
{'fraction_non_alphanumeric': 0.12937433722163308, 'fraction_numerical': 0.0005302226935312832, 'mean_word_length': 2.23862660944206, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, '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': '4259206', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1032, 'n_words': 221}