<commit_before><?php
/**
 * @file
 */

namespace CultuurNet\UDB3\CommandHandling;


class QueueJob {

    public function perform()
    {
        $command = unserialize($this->args['command']);

        global $app;

        /** @var ResqueCommandBus $commandBus */
        $commandBus = $app['event_command_bus'];
        $commandBus->deferredDispatch($command);
    }
} <commit_msg>Ensure that queued jobs transfer their context to the command bus when they are performed<commit_after><?php
/**
 * @file
 */

namespace CultuurNet\UDB3\CommandHandling;


class QueueJob {

    public function perform()
    {
        $command = unserialize($this->args['command']);
        global $app;

        /** @var ResqueCommandBus $commandBus */
        $commandBus = $app['event_command_bus'];

        if ($commandBus instanceof ContextAwareInterface) {
            $context = unserialize($this->args['context']);
            $commandBus->setContext($context);
        }

        $commandBus->deferredDispatch($command);
    }
} 
{'fraction_non_alphanumeric': 0.1350293542074364, 'fraction_numerical': 0.0019569471624266144, 'mean_word_length': 2.875, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '224719', 'n_tokens_mistral': 296, 'n_tokens_neox': 289, 'n_words': 59}