Permalink
Browse files

Added FlashData

  • Loading branch information...
1 parent 03a00e0 commit 769549c6cfc9d63c315d5195a84132e4a6eb439d @Shaneprrlt committed Dec 15, 2011
Showing with 38 additions and 1 deletion.
  1. +1 −1 atomic/Models/Model.php
  2. +37 −0 atomic/Utilities/FlashData.php
View
@@ -1,6 +1,6 @@
<?php
-namespace Atomic\Views;
+namespace Atomic\Models;
/*
* Created for AtomicPHP Framework
@@ -0,0 +1,37 @@
+<?php
+
+namespace Atomic\Utilities;
+
+/*
+ * Created for AtomicPHP Framework
+ * Copyright 2011 Shane Perreault All Rights Reserved
+ */
+
+class FlashData {
+
+ /**
+ * FlashData Accessor Method
+ * FlashData is readable persistence
+ * data that gets deleted once it is
+ * read.
+ */
+
+ public function __get($key) {
+ if(!isset($_SESSION["flashdata_" . $key])) {
+ return null;
+ }
+ $value = $_SESSION["flashdata_" . $key];
+ unset($_SESSION["flashdata_" . $key]);
+ return $value;
+ }
+
+ /**
+ * FlashData mutator method
+ * Sets a flash Data value
+ */
+
+ public function __set($key, $value) {
+ $_SESSION["flashdata_" . $key] = $value;
+ }
+
+}

0 comments on commit 769549c

Please sign in to comment.