<commit_before><?php

namespace SimplyTestable\ApiBundle\Resque\Job;

use SimplyTestable\ApiBundle\Exception\JobPrepareException;
use Symfony\Component\DependencyInjection\ContainerInterface;

abstract class CommandLineJob extends AbstractJob {    
    
    abstract protected function getQueueName();
    abstract protected function getArgumentOrder();
    abstract protected function getCommand();
    abstract protected function failureHandler($output, $returnValue);
    
    
    public function __construct(ContainerInterface $container) {
        parent::__construct($container);
        $this->setQueue($this->getQueueName());
    }
    
    public function perform() {
        $output = array();
        $returnValue = null;       
        
        exec($this->buildCommand(), $output, $returnValue);
        
        if ($returnValue !== 0) {
            $this->failureHandler($output, $returnValue);
        }
    }
    
    
    /**
     * The command line command to run, including all arguments in the correct
     * order
     * 
     * @return string
     */
    private function buildCommand() {<commit_msg>Don't extend Glit\ResqueBundle\Job\BaseJob, it's naf<commit_after><?php

namespace SimplyTestable\ApiBundle\Resque\Job;

use SimplyTestable\ApiBundle\Exception\JobPrepareException;
use Symfony\Component\DependencyInjection\ContainerInterface;

abstract class CommandLineJob extends AbstractJob {    
    
    abstract protected function getQueueName();
    abstract protected function getArgumentOrder();
    abstract protected function getCommand();
    abstract protected function failureHandler($output, $returnValue);
    
    public function perform() {
        $output = array();
        $returnValue = null;       
        
        exec($this->buildCommand(), $output, $returnValue);
        
        if ($returnValue !== 0) {
            $this->failureHandler($output, $returnValue);
        }
    }
    
    
    /**
     * The command line command to run, including all arguments in the correct
     * order
     * 
     * @return string
     */
    private function buildCommand() {
{'fraction_non_alphanumeric': 0.09636277751535191, 'fraction_numerical': 0.000944733112895607, 'mean_word_length': 2.8231046931407944, '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': '6538575', 'n_tokens_mistral': 530, 'n_tokens_neox': 525, 'n_words': 134}