<commit_before><?php
/**
 * Created by PhpStorm.
 * User: inisire
 * Date: 20.05.15
 * Time: 23:41
 */

namespace React\Http\Processor;

use Evenement\EventEmitter;
use React\Http\Foundation\File;
use React\Http\Foundation\HeaderDictionary;
use React\Http\Request;

/**
 * Class MultipartDataProcessor
 *
 * @event   data
 *
 * @package React\Http\Processor
 */
class UrlencodedDataProcessor extends AbstractProcessor
{
    /**
     * @var Request
     */
    private $request;

    /**
     * @var int
     */
    private $contentLength;

    /**
     * @var string
     */
    private $data;

    /**
     * @var int
     */
    private $readLength;

    /**
     * UrlencodedDataProcessor constructor.
     *
     * @param Request $request
     */
    public function __construct(Request $request)
    {
        $this->request = $request;
        $this->contentLength = (int) $request->headers->get('content-length');
        $this->readLength = 0;
        $this->data = '';
    }

    /**
     * @param $data
     */
    public function parse($data)
    {
        parse_str($data, $data);
        foreach ($data as $key => $value) {
            $field = new FormField($key);

            if (is_array($value)) {
                array_walk_recursive($value, function (&$value) {
                    $value = urldecode($value);
                });
            } else {
                $value = urldecode($value);
            }

            $this->emit('data', [$field]);
            $field->emit('end', [$value]);
        }
        $this->emit('end');
    }

    /**
     * @param $data
     */
    public function process($data)
    {
        $this->readLength += strlen($data);
        $this->data .= $data;
        if ($this->readLength >= $this->contentLength) {
            $this->parse($this->data);
        }
    }

    public function isWritable()
    {
        // TODO: Implement isWritable() method.
    }

    public function write($data)
    {
        // TODO: Implement write() method.
    }

    public function end($data = null)
    {
        // TODO: Implement end() method.
    }

    public function close()
    {
        // TODO: Implement close() method.
    }
}<commit_msg>Order<commit_after><?php
/**
 * Created by PhpStorm.
 * User: inisire
 * Date: 20.05.15
 * Time: 23:41
 */

namespace React\Http\Processor;

use Evenement\EventEmitter;
use React\Http\Foundation\File;
use React\Http\Foundation\HeaderDictionary;
use React\Http\Request;

/**
 * Class MultipartDataProcessor
 *
 * @event   data
 *
 * @package React\Http\Processor
 */
class UrlencodedDataProcessor extends AbstractProcessor
{
    /**
     * @var Request
     */
    private $request;

    /**
     * @var int
     */
    private $contentLength;

    /**
     * @var string
     */
    private $data;

    /**
     * @var int
     */
    private $readLength;

    /**
     * UrlencodedDataProcessor constructor.
     *
     * @param Request $request
     */
    public function __construct(Request $request)
    {
        $this->request = $request;
        $this->contentLength = (int) $request->headers->get('content-length');
        $this->readLength = 0;
        $this->data = '';
    }

    /**
     * @param $data
     */
    public function parse($data)
    {
        parse_str($data, $data);
        foreach ($data as $key => $value) {
            $field = new FormField($key);

//            if (is_array($value)) {
//                array_walk_recursive($value, function (&$value) {
//                    $value = urldecode($value);
//                });
//            } else {
//                $value = urldecode($value);
//            }

            $this->emit('data', [$field]);
            $field->emit('end', [$value]);
        }
        $this->emit('end');
    }

    /**
     * @param $data
     */
    public function process($data)
    {
        $this->readLength += strlen($data);
        $this->data .= $data;
        if ($this->readLength >= $this->contentLength) {
            $this->parse($this->data);
        }
    }

    public function isWritable()
    {
        // TODO: Implement isWritable() method.
    }

    public function write($data)
    {
        // TODO: Implement write() method.
    }

    public function end($data = null)
    {
        // TODO: Implement end() method.
    }

    public function close()
    {
        // TODO: Implement close() method.
    }
}
{'fraction_non_alphanumeric': 0.153706230104593, 'fraction_numerical': 0.0050022737608003635, 'mean_word_length': 1.7476577139287945, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, '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': '5551613', 'n_tokens_mistral': 1348, 'n_tokens_neox': 1305, 'n_words': 270}