Skip to content

Commit

Permalink
Added FlashData
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaneprrlt committed Dec 15, 2011
1 parent 03a00e0 commit 769549c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion atomic/Models/Model.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Atomic\Views;
namespace Atomic\Models;

/*
* Created for AtomicPHP Framework
Expand Down
37 changes: 37 additions & 0 deletions atomic/Utilities/FlashData.php
Original file line number Diff line number Diff line change
@@ -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.