From f68a918d6988ee748e4aabab8011f3b3e8db2f45 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 12 Oct 2011 22:29:49 -0500 Subject: [PATCH] refactoring session classes. --- laravel/session/payload.php | 21 +++++++++++---------- laravel/session/transporters/cookie.php | 6 +++--- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/laravel/session/payload.php b/laravel/session/payload.php index 780d26b3..e718a10f 100644 --- a/laravel/session/payload.php +++ b/laravel/session/payload.php @@ -41,8 +41,6 @@ public function has($key) /** * Get an item from the session. * - * A default value may also be specified, and will be returned in the item doesn't exist. - * * * // Get an item from the session * $name = Session::get('name'); @@ -90,8 +88,9 @@ public function put($key, $value) /** * Write an item to the session flash data. * - * Flash data only exists for the next request. After that, it will be removed from - * the session. Flash data is useful for temporary status or welcome messages. + * Flash data only exists for the next request. After that, it will + * be removed from the session. Flash data is useful for temporary + * status or welcome messages. * * * // Flash an item to the session @@ -122,8 +121,9 @@ public function reflash() /** * Keep a session flash item from expiring at the end of the request. * - * If a string is passed to the method, only that item will be kept. An array may also - * be passed to the method, in which case all items in the array will be kept. + * If a string is passed to the method, only that item will be kept. + * An array may also be passed to the method, in which case all + * items in the array will be kept. * * * // Keep a session flash item from expiring @@ -178,8 +178,8 @@ public function regenerate() /** * Age the session payload, preparing it for storage after a request. * - * The session flash data will be aged and the last activity timestamp will be updated. - * The aged session array will be returned by the method. + * The session flash data will be aged and the last activity timestamp will + * be updated. The aged session array will be returned by the method. * * @return array */ @@ -187,8 +187,9 @@ public function age() { $this->session['last_activity'] = time(); - // To age the data, we will forget all of the old keys and then rewrite the newly - // flashed items to have old keys, which will be available for the next request. + // To age the data, we will forget all of the old keys and then + // rewrite the newly flashed items to have old keys, which will + // be available for the next request. foreach ($this->session['data'] as $key => $value) { if (strpos($key, ':old:') === 0) $this->forget($key); diff --git a/laravel/session/transporters/cookie.php b/laravel/session/transporters/cookie.php index bcd95d3a..3ec0ef4a 100644 --- a/laravel/session/transporters/cookie.php +++ b/laravel/session/transporters/cookie.php @@ -29,9 +29,9 @@ public function get($config) */ public function put($id, $config) { - // Session cookies may be set to expire on close, which means we will need to - // pass "0" into the cookie manager. This will cause the cookie to not be - // deleted until the user closes their browser. + // Session cookies may be set to expire on close, which means we + // will need to pass "0" into the cookie manager. This will cause + // the cookie to not be deleted until the user closes their browser. $minutes = ( ! $config['expire_on_close']) ? $config['lifetime'] : 0; \Laravel\Cookie::put(Cookie::key, $id, $minutes, $config['path'], $config['domain'], $config['secure']);