<commit_before><?php

namespace Codeception\Util\Connector;

use Nette\DI\Container;
use Nette\Diagnostics\Debugger;
use Nette\Environment;
use Nette\Http\IResponse;
use Symfony\Component\BrowserKit\Client;
use Symfony\Component\BrowserKit\Request;
use Symfony\Component\BrowserKit\Response;

/**
 * @author <NAME>
 */
class Nette extends Client
{

	/** @var Container */
	protected $container;

	public function setContainer(Container $container)
	{
		$this->container = $container;
	}

    /**
	 * @param Request $request
	 * @return Response
	 */
	public function doRequest($request)
	{
		$_COOKIE = $request->getCookies();
		$_SERVER = $request->getServer();
		$_FILES = $request->getFiles();

		$uri = str_replace('http://localhost', '', $request->getUri());

		$_SERVER['REQUEST_METHOD'] = strtoupper($request->getMethod());
		$_SERVER['REQUEST_URI'] = $uri;

		$this->container->initialize();
		Environment::setContext($this->container);

		ob_start();
		try {
			$this->container->getByType('Nette\Application\Application')->run();
		} catch (\Exception $e) {
			ob_end_clean();
			Debugger::log($e);
			throw $e;
		}
		$content = ob_get_clean();

		$httpResponse = $this->container->getByType('Nette\Http\IResponse');
		$code = $httpResponse->getCode() ?: IResponse::S200_OK; // @see https://github.com/nette/nette/issues/1263
		$headers = $httpResponse->getHeaders();

		$repsonse = new Response($content, $code, $headers);
		return $repsonse;
	}

}
<commit_msg>Fixed isolation for response codes<commit_after><?php

namespace Codeception\Util\Connector;

use Nette\DI\Container;
use Nette\Diagnostics\Debugger;
use Nette\Environment;
use Nette\Http\IResponse;
use Symfony\Component\BrowserKit\Client;
use Symfony\Component\BrowserKit\Request;
use Symfony\Component\BrowserKit\Response;

/**
 * @author <NAME>
 */
class Nette extends Client
{

	/** @var Container */
	protected $container;

	public function setContainer(Container $container)
	{
		$this->container = $container;
	}

    /**
	 * @param Request $request
	 * @return Response
	 */
	public function doRequest($request)
	{
		$_COOKIE = $request->getCookies();
		$_SERVER = $request->getServer();
		$_FILES = $request->getFiles();

		$uri = str_replace('http://localhost', '', $request->getUri());

		$_SERVER['REQUEST_METHOD'] = strtoupper($request->getMethod());
		$_SERVER['REQUEST_URI'] = $uri;

		$this->container->initialize();
		Environment::setContext($this->container);

		ob_start();
		try {
			// The HTTP code from previous test sometimes survives in http_response_code() so it's necessary to reset it manually.
			// @link https://github.com/nette/nette/pull/1263
			$this->container->getByType('Nette\Http\IResponse')->setCode(IResponse::S200_OK);
			$this->container->getByType('Nette\Application\Application')->run();
		} catch (\Exception $e) {
			ob_end_clean();
			Debugger::log($e);
			throw $e;
		}
		$content = ob_get_clean();

		$httpResponse = $this->container->getByType('Nette\Http\IResponse');
		$code = $httpResponse->getCode();
		$headers = $httpResponse->getHeaders();

		$repsonse = new Response($content, $code, $headers);
		return $repsonse;
	}

}

{'fraction_non_alphanumeric': 0.16941624365482233, 'fraction_numerical': 0.004441624365482234, 'mean_word_length': 4.701627486437613, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 40, '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': '5145656', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1011, 'n_words': 189}