Added ability to get all saved variables.

pull/151/head
Mike Cao 10 years ago
parent 3b576003fa
commit ef76d72b56

@ -1 +1 @@
1.2.5
1.2.6

@ -213,7 +213,9 @@ class Engine {
* @param string $key Key
* @return mixed
*/
public function get($key) {
public function get($key = null) {
if ($key === null) return $this->vars;
return isset($this->vars[$key]) ? $this->vars[$key] : null;
}

@ -34,6 +34,19 @@ class FlightTest extends PHPUnit_Framework_TestCase
$var = Flight::get('a');
$this->assertEquals(1, $var);
Flight::clear();
$vars = Flight::get();
$this->assertEquals(0, count($vars));
Flight::set('a', 1);
Flight::set('b', 2);
$vars = Flight::get();
$this->assertEquals(2, count($vars));
$this->assertEquals(1, $vars['a']);
$this->assertEquals(2, $vars['b']);
}
// Register a class

Loading…
Cancel
Save