Skip to content

Instantly share code, notes, and snippets.

@nedmas
Created June 20, 2012 15:23
Show Gist options
  • Save nedmas/2960453 to your computer and use it in GitHub Desktop.
Save nedmas/2960453 to your computer and use it in GitHub Desktop.
Message class for FuelPHP by Frank de Jonge (FrenkyNet)
<?php
abstract class Message
{
protected static $messages = array();
public static function get($key, $default = null)
{
$return = \Arr::get(static::$messages, $key, $default);
\Arr::delete(static::$messages, $key);
return $return;
}
public static function set($key, $value = null)
{
\Arr::set(static::$messages, $key, $value);
}
public static function _init()
{
static::$messages = \Session::get('messages', array());
$messages = &static::$messages;
\Event::register('shutdown', function() use($messages){
\Session::set('messages', $messages);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment