<commit_before><?php
/**
* This controller is responsible of session management
* @author <NAME>
*/
class SessionManager
{
	function __construct($sessionVariables = array())
    {
    }

	public function newOrResetSession($posteData)
	{
		if(session_status() === PHP_SESSION_ACTIVE)
		{
			$this->endSession();
		}

		session_start();
		$_SESSION = $posteData;
	}

	public function endSession()
	{
		session_destroy();
	}

	public function getSessionVariable($sessionVariableName = null)
	{		
		if(session_status() !== PHP_SESSION_ACTIVE)
		{
			session_start();
		}
			if($sessionVariableName)
			{
				return $_SESSION[$sessionVariableName];	
			}
			return $_SESSION;
		throw new Exception("Could not get session variable, no active session active session", 1);<commit_msg>hotfix: unsetting session before destroying it + debugged the get session variable method<commit_after><?php
/**
* This controller is responsible of session management
* @author <NAME>
*/
class SessionManager
{
	function __construct($sessionVariables = array())
    {
    }

	public function newOrResetSession($posteData)
	{
		if(session_status() === PHP_SESSION_ACTIVE)
		{
			$this->endSession();
		}

		session_start();
		$_SESSION = $posteData;
	}

	public function endSession()
	{
		session_start();
		session_unset();
		session_destroy();
	}

	public function getSessionVariable($sessionVariableName = null)
	{	
		session_start();

		if($sessionVariableName)
		{
			return $_SESSION[$sessionVariableName];	
		}
		return $_SESSION;
{'fraction_non_alphanumeric': 0.11904761904761904, 'fraction_numerical': 0.0006613756613756613, 'mean_word_length': 4.501818181818182, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3294299', 'n_tokens_mistral': 504, 'n_tokens_neox': 455, 'n_words': 103}