<commit_before><?php

require_once dirname(__FILE__).'/AppComponent.php';

/**
 * Flash Message Types
 * 
 * @package nms.update
 * @subpackage nms.update.lib.component
 * @since 2009-10-10
 * @author <NAME> // Ephigenia <<EMAIL>>
 */
class FlashMessageType
{	
	const ERROR = 'error';
	const HINT = 'hint';
}

/**
 * Component to manage little flashing message for views
 * 
 * Example Controller code:
 * <code>
 * if (!$this->User->save()) {
 * 	$this->FlashMessage->set('Error while saving', FlashMessageType::ERROR);
 * }
 * </code>
 * 
 * @package nms.update
 * @subpackage nms.update.lib.component
 * @author Ephigenia // <NAME> <<EMAIL>>
 * @since 09.03.2009
 */
class FlashMessage extends AppComponent
{
	public $components = array(
		'Session',
	);

	public $sessionVarname = 'flashMessage';
	
	public function beforeRender()
	{
		if (!$this->Session->isEmpty($this->sessionVarname)) {
			$this->controller->data->set('flashMessage', $this->Session->get($this->sessionVarname));
			$this->reset();
		}
		return parent::beforeRender();
	}
	
	public function set($message, $type = FlashMessageType::HINT)
	{
		$this->Session->set($this->sessionVarname, array(
			'message' => $message,
			'type' => $type
		));
		return $this;	
	}
	
	public function delete()
	{
		$this->Session->set($this->sessionVarname, false);
		return $this;
	}
}<commit_msg>+ fixed call to reset and calls delete now for flashmessage clear<commit_after><?php

require_once dirname(__FILE__).'/AppComponent.php';

/**
 * Flash Message Types
 * 
 * @package nms.update
 * @subpackage nms.update.lib.component
 * @since 2009-10-10
 * @author <NAME> // Ephigenia <<EMAIL>>
 */
class FlashMessageType
{	
	const ERROR = 'error';
	const HINT = 'hint';
}

/**
 * Component to manage little flashing message for views
 * 
 * Example Controller code:
 * <code>
 * if (!$this->User->save()) {
 * 	$this->FlashMessage->set('Error while saving', FlashMessageType::ERROR);
 * }
 * </code>
 * 
 * @package nms.update
 * @subpackage nms.update.lib.component
 * @author Ephigenia // <NAME> <<EMAIL>>
 * @since 09.03.2009
 */
class FlashMessage extends AppComponent
{
	public $components = array(
		'Session',
	);

	public $sessionVarname = 'flashMessage';
	
	public function beforeRender()
	{
		if (!$this->Session->isEmpty($this->sessionVarname)) {
			$this->controller->data->set('flashMessage', $this->Session->get($this->sessionVarname));
			$this->delete();
		}
		return parent::beforeRender();
	}
	
	public function set($message, $type = FlashMessageType::HINT)
	{
		$this->Session->set($this->sessionVarname, array(
			'message' => $message,
			'type' => $type
		));
		return $this;	
	}
	
	public function delete()
	{
		$this->Session->set($this->sessionVarname, false);
		return $this;
	}
}
{'fraction_non_alphanumeric': 0.17566099239406013, 'fraction_numerical': 0.011590003621876132, 'mean_word_length': 4.077205882352941, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 63, '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': '1988789', 'n_tokens_mistral': 987, 'n_tokens_neox': 903, 'n_words': 199}