<commit_before><?php
namespace MicroAPI;

class Request extends Singleton
{
	private $method;
	private $params;
	private $path;
	private $pathString;

	protected function __construct()
	{
		//Store the request method
		$this->method = $_SERVER['REQUEST_METHOD'];

		//Store the data for each request type into the $this->params variable
		switch($this->method)
		{
			case 'GET':
				$this->params = $_GET;
				//Remove the path
				unset($this->params['_path']);
				break;
			case 'POST':
				$this->params = $_POST;
				break;
			case 'PUT':
				parse_str(file_get_contents('php://input'), $this->params);
				break;
			case 'DELETE':
				parse_str(file_get_contents('php://input'), $this->params);
				break;
		}
		array_map('htmlspecialchars', $this->params);

		//Store the path
		$this->pathString = $_GET['_path'];
		$this->path = explode('/', $pathString);
	}

	/**
	 * The method the request was using. GET, POST, PUT or DELETE.
	 *
	 * @return The method the request was using.
	 */
	public function getMethod()
	{
		return $this->method;
	}

	/**
	 * Provides a way of accessing the request parameters 
	 *
	 */
	public function getParam($var)
	{
		return (isset($this->data[$var])) ? $this->data[$var] : false;
	}

	public function getPath()
	{
		return $this->path;
	}

	public function getPathString()
	{
		return $this->pathString;<commit_msg>Fixed PHP warning<commit_after><?php
namespace MicroAPI;

class Request extends Singleton
{
	private $method;
	private $params;
	private $path;
	private $pathString;

	protected function __construct()
	{
		//Store the request method
		$this->method = $_SERVER['REQUEST_METHOD'];

		//Store the data for each request type into the $this->params variable
		switch($this->method)
		{
			case 'GET':
				$this->params = $_GET;
				//Remove the path
				unset($this->params['_path']);
				break;
			case 'POST':
				$this->params = $_POST;
				break;
			case 'PUT':
				parse_str(file_get_contents('php://input'), $this->params);
				break;
			case 'DELETE':
				parse_str(file_get_contents('php://input'), $this->params);
				break;
		}
		array_map('htmlspecialchars', $this->params);

		//Store the path
		$this->pathString = $_GET['_path'];
		$this->path = explode('/', $this->pathString);
	}

	/**
	 * The method the request was using. GET, POST, PUT or DELETE.
	 *
	 * @return The method the request was using.
	 */
	public function getMethod()
	{
		return $this->method;
	}

	/**
	 * Provides a way of accessing the request parameters 
	 *
	 */
	public function getParam($var)
	{
		return (isset($this->data[$var])) ? $this->data[$var] : false;
	}

	public function getPath()
	{
		return $this->path;
	}

	public function getPathString()
	{
		return $this->pathString;
{'fraction_non_alphanumeric': 0.156158357771261, 'fraction_numerical': 0.0, 'mean_word_length': 3.4591503267973858, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 36, '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': '6470698', 'n_tokens_mistral': 1017, 'n_tokens_neox': 879, 'n_words': 237}