<commit_before>export default class Template {

    constructor(props) {
        this.props = props
        this.padding = ' '.repeat(4)
    }

    renderHeaders(headers) {
        let offset = this.padding.repeat(3)

        let phpCode = []
        if (headers) {
            let headerNames = Object.keys(headers)
            for (let name of headerNames) {
                let _header = '"' + name + '" => "' + headers[name] + '"'
                phpCode.push(_header)
            }
        }


        if (phpCode.length === 0) {
            return '[]'
        }

        return '[\n' + offset +
            phpCode.join(',\n' + offset) + '\n' +
            this.padding.repeat(2) + ']'
    }

    renderRequestObjects(requests) {
        let reqArray = requests.map(request => {
            let _body = JSON.stringify(request.body) || null

            let body = []
            if (_body.length > 5000) {
                body = [ '# body was too long to be included\n', '"")' ]
            }
            else {
                body = [ _body + ')' ]
            }

            let result = [
                'new Request(\n',
                '"' + request.method + '",\n',
                '"' + request.uri + '",\n',
                this.renderHeaders(request.headers) + ',\n'
            ].concat(body)

            return result.join(this.padding.repeat(2))
        })

        return reqArray.join(',\n' + this.padding)
    }

    renderSingleRequest() {
        return `$request = ` +
            ::this.renderRequestObjects(this.props.requests) + `;

$response = $client->send($request);
echo "Response HTTP : " . $response->getStatusCode();`
    }

    renderMultipleRequests() {
        return `$requests = [
    ` + ::this.renderRequestObjects(this.props.requests) + `
];

$pool = new Pool($client, $requests, [
    "concurrency" => 5,
    "fulfilled" => function ($response, $index) {
        // this is delivered each successful response
        echo "Response HTTP : " . $response->getStatusCode();
    },
    "rejected" => function ($reason, $index) {<commit_msg>slight improvement to echo for single request<commit_after>export default class Template {

    constructor(props) {
        this.props = props
        this.padding = ' '.repeat(4)
    }

    renderHeaders(headers) {
        let offset = this.padding.repeat(3)

        let phpCode = []
        if (headers) {
            let headerNames = Object.keys(headers)
            for (let name of headerNames) {
                let _header = '"' + name + '" => "' + headers[name] + '"'
                phpCode.push(_header)
            }
        }


        if (phpCode.length === 0) {
            return '[]'
        }

        return '[\n' + offset +
            phpCode.join(',\n' + offset) + '\n' +
            this.padding.repeat(2) + ']'
    }

    renderRequestObjects(requests) {
        let reqArray = requests.map(request => {
            let _body = JSON.stringify(request.body) || null

            let body = []
            if (_body.length > 5000) {
                body = [ '# body was too long to be included\n', '"")' ]
            }
            else {
                body = [ _body + ')' ]
            }

            let result = [
                'new Request(\n',
                '"' + request.method + '",\n',
                '"' + request.uri + '",\n',
                this.renderHeaders(request.headers) + ',\n'
            ].concat(body)

            return result.join(this.padding.repeat(2))
        })

        return reqArray.join(',\n' + this.padding)
    }

    renderSingleRequest() {
        return `$request = ` +
            ::this.renderRequestObjects(this.props.requests) + `;

$response = $client->send($request);
echo "Response HTTP : " . $response->getStatusCode() . "\n";`
    }

    renderMultipleRequests() {
        return `$requests = [
    ` + ::this.renderRequestObjects(this.props.requests) + `
];

$pool = new Pool($client, $requests, [
    "concurrency" => 5,
    "fulfilled" => function ($response, $index) {
        // this is delivered each successful response
        echo "Response HTTP : " . $response->getStatusCode();
    },
    "rejected" => function ($reason, $index) {
{'fraction_non_alphanumeric': 0.15219976218787157, 'fraction_numerical': 0.0047562425683709865, 'mean_word_length': 1.653627760252366, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '2045324', 'n_tokens_mistral': 1238, 'n_tokens_neox': 1177, 'n_words': 245}