<commit_before><?php

/*  httpstreamformat.php
    ~~~~~~~~~
    This module implements the HttpStreamFormat class.
    :authors: <NAME>.
    :copyright: (c) 2015 by Fanout, Inc.
    :license: MIT, see LICENSE for more details. */

class HttpStreamFormat extends Format
{
    public $content = null;
    public $close = null;

    public function __construct($content=null, $close=false)
    {
        $this->content = $content;
        $this->close = $close;
        if (!$this->close && is_null($this->content))
            throw new RuntimeException('Content not set');
    }

    public function name()
    {
        return 'http-stream';
    }

    public function export()
    {
        $out = array();
        if ($this->close)
            $out['action'] = 'close';
        else
        {
            if (Encoding::is_binary_data($this->content))
                $out['body-bin'] = base64_encode($this->content);
            else
                $out['body'] = $this->content;
        }
        return $out;
    }
}
?><commit_msg>fixed a bug with httpstreamformat<commit_after><?php

/*  httpstreamformat.php
    ~~~~~~~~~
    This module implements the HttpStreamFormat class.
    :authors: <NAME>.
    :copyright: (c) 2015 by Fanout, Inc.
    :license: MIT, see LICENSE for more details. */

class HttpStreamFormat extends Format
{
    public $content = null;
    public $close = null;

    public function __construct($content=null, $close=false)
    {
        $this->content = $content;
        $this->close = $close;
        if (!$this->close && is_null($this->content))
            throw new RuntimeException('Content not set');
    }

    public function name()
    {
        return 'http-stream';
    }

    public function export()
    {
        $out = array();
        if ($this->close)
            $out['action'] = 'close';
        else
        {
            if (Encoding::is_binary_data($this->content))
                $out['content-bin'] = base64_encode($this->content);
            else
                $out['content'] = $this->content;
        }
        return $out;
    }
}
?>
{'fraction_non_alphanumeric': 0.1438095238095238, 'fraction_numerical': 0.005714285714285714, 'mean_word_length': 2.049346879535559, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4406716', 'n_tokens_mistral': 617, 'n_tokens_neox': 598, 'n_words': 150}