Created
June 20, 2012 15:23
-
-
Save nedmas/2960453 to your computer and use it in GitHub Desktop.
Message class for FuelPHP by Frank de Jonge (FrenkyNet)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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