From 5cc61666fe7e285fb8d2b15169b709694fbb5f1e Mon Sep 17 00:00:00 2001 From: Joey Kimsey Date: Sat, 10 Aug 2024 15:49:29 -0400 Subject: [PATCH] bugfixes --- Functions/Session.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Functions/Session.php b/Functions/Session.php index b39c93a..9d47db0 100644 --- a/Functions/Session.php +++ b/Functions/Session.php @@ -21,14 +21,14 @@ class Session { * @return {bool} */ public static function exists( $name ) { - if ( !Check::sessionName( $name ) ) { + if ( ! Check::sessionName( $name ) ) { return false; } $sessionName = DEFAULT_SESSION_PREFIX . $name; - if ( isset( $_SESSION[$sessionName] ) ) { + if ( isset( $_SESSION[ $sessionName ] ) ) { return true; } - Debug::info("Session::exists - Session not found: $sessionName"); + Debug::info( "Session::exists - Session not found: $sessionName" ); return false; } @@ -39,14 +39,14 @@ class Session { * @return {string|bool} - Returns the data from the session or false if nothing is found.. */ public static function get( $name ) { - if ( !Check::sessionName( $name ) ) { + if ( ! Check::sessionName( $name ) ) { return false; } - if ( self::exists( $name ) ) { - $sessionName = DEFAULT_SESSION_PREFIX . $name; - return $_SESSION[$sessionName]; + $sessionName = DEFAULT_SESSION_PREFIX . $name; + if ( self::exists( $sessionName ) ) { + return $_SESSION[ $sessionName ]; } - Debug::info("Session::get - Session not found: $name"); + Debug::info( "Session::get - Session not found: $sessionName" ); return false; } @@ -58,12 +58,12 @@ class Session { * @return {bool} */ public static function put( $name, $data ) { - if ( !Check::sessionName( $name ) ) { + if ( ! Check::sessionName( $name ) ) { return false; } $sessionName = DEFAULT_SESSION_PREFIX . $name; - $_SESSION[$sessionName] = $data; - Debug::info("Session: Created: $sessionName"); + $_SESSION[ $sessionName ] = $data; + Debug::info( "Session::get - Created/Updated: $sessionName" ); return true; } @@ -74,16 +74,16 @@ class Session { * @return {bool} */ public static function delete( $name ) { - if ( !Check::sessionName( $name ) ) { + if ( ! Check::sessionName( $name ) ) { return false; } + $sessionName = DEFAULT_SESSION_PREFIX . $name; if ( self::exists( $name ) ) { - $sessionName = DEFAULT_SESSION_PREFIX . $name; unset( $_SESSION[$sessionName] ); - Debug::info("Session::deleted: $sessionName"); + Debug::info( "Session::delete - Deleted $sessionName" ); return true; } - Debug::error("Session::delete - Session not found."); + Debug::error( "Session::delete - Session not found." ); return false; } @@ -97,7 +97,7 @@ class Session { * @return bool|string - Returns bool if creating, and a string if the check is successful. */ public static function checkFlash( $name ) { - if ( !Check::sessionName( $name ) ) { + if ( ! Check::sessionName( $name ) ) { return false; } if ( self::exists( $name ) ) { @@ -110,10 +110,10 @@ class Session { } public static function flash( $name, $data = null ) { - if ( !Check::sessionName( $name ) ) { + if ( ! Check::sessionName( $name ) ) { return false; } - if ( !empty( $data ) ) { + if ( ! empty( $data ) ) { self::put( $name, $data ); Debug::info("Session::flash - Session created."); return true;