<commit_before><?php
/**
 * Handles REQUEST file specific actions
 */

namespace Graviton\FileBundle\Manager;

use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\RequestStack;

/**
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link     http://swisscom.ch
 */
class RequestManager
{
    /**
     * @var RequestStack
     */
    private $requestStack;

    /**
     * RequestManager constructor.
     *
     * @param RequestStack $requestStack To get the original request
     */
    public function __construct(RequestStack $requestStack)
    {
        $this->requestStack = $requestStack;
    }


    /**
     * Simple RAW http request parser.
     * Ideal for PUT requests where PUT is streamed but you still need the data.
     *
     * @param Request $request Sf data request
     * @return Request
     */
    public function updateFileRequest(Request $request)
    {
        $original = $this->requestStack->getMasterRequest();
        $input = $original ? $original->getContent() : false;

        if (!$input) {
            return $request;
        }

        $input = urldecode($input);
        $server = $request->server;
        $contentType = $server->get('CONTENT_TYPE', $server->get('HTTP_CONTENT_TYPE'));
        $data = [];<commit_msg>Content shall not be decoded<commit_after><?php
/**
 * Handles REQUEST file specific actions
 */

namespace Graviton\FileBundle\Manager;

use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\RequestStack;

/**
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link     http://swisscom.ch
 */
class RequestManager
{
    /**
     * @var RequestStack
     */
    private $requestStack;

    /**
     * RequestManager constructor.
     *
     * @param RequestStack $requestStack To get the original request
     */
    public function __construct(RequestStack $requestStack)
    {
        $this->requestStack = $requestStack;
    }


    /**
     * Simple RAW http request parser.
     * Ideal for PUT requests where PUT is streamed but you still need the data.
     *
     * @param Request $request Sf data request
     * @return Request
     */
    public function updateFileRequest(Request $request)
    {
        $original = $this->requestStack->getMasterRequest();
        $input = $original ? $original->getContent() : false;

        if (!$input) {
            return $request;
        }

        $server = $request->server;
        $contentType = $server->get('CONTENT_TYPE', $server->get('HTTP_CONTENT_TYPE'));
        $data = [];
{'fraction_non_alphanumeric': 0.11651110395880271, 'fraction_numerical': 0.0, 'mean_word_length': 2.954198473282443, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, 'https://': 2, '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': '6996', 'n_tokens_mistral': 888, 'n_tokens_neox': 864, 'n_words': 204}