Overview

Namespaces

  • Core
    • Auth
    • Exceptions
    • Helpers
    • Providers
  • Kernel
    • Dispatch
    • Providers
  • None
  • Vendor
    • ExampleVendor

Classes

  • Config
  • Service
  • Session
  • Overview
  • Namespace
  • Class
  • Download

Class Session

Manages the $_SESSION global with getters, setters and destructors.

Namespace: Core\Providers
Package: Core
Usage: Please see \Core\Session::__callStatic
Located at app/Kernel/Providers/Session.php
Methods summary
public static mixed
# set( string $key, mixed $value )

Sets a $_SESSION[$key] = $value. Do not use directly.

Sets a $_SESSION[$key] = $value. Do not use directly.

Parameters

$key
The key where to save it
$value
The value to save

Returns

mixed
The value set

See

Session::__callStatic
public static mixed
# get( string $key = NULL )

Gets the value of a $_SESSION key. Do not use directly.

Gets the value of a $_SESSION key. Do not use directly.

Parameters

$key

Returns

mixed
$_SESSION[key] if it exists, NULL otherwise

See

Session::__callStatic
public static mixed
# getExt( string $key, string $subKey )

Gets $_SESSION[$key][$subKey] if exists, $_SESSION[$key] otherwise or NULL. Do not use directly.

Gets $_SESSION[$key][$subKey] if exists, $_SESSION[$key] otherwise or NULL. Do not use directly.

Parameters

$key
The key where it's set
$subKey
The subkey where it's set

Returns

mixed
SESSION[key][subKey] if exists or NULL if it doesn't

See

Session::__callStatic
public static null
# clean( string $key = NULL )

Cleans a session parameter if $key is specified, or cleans the whole $_SESSION otherwise. Do not use directly.

Cleans a session parameter if $key is specified, or cleans the whole $_SESSION otherwise. Do not use directly.

Parameters

$key
= NULL. If not specified, sets $_SESSION = NULL; otherwise, unsets $_SESSION[key]

Returns

null

See

Session::__callStatic
public static boolean
# isUser( )

Returns whether the user is authenticated or not

Returns whether the user is authenticated or not

Returns

boolean
Whether the user is logged in or not (i.e. whether is user|TRUE or guest|FALSE)
public static boolean
# isAdmin( )

Returns whether the user is superuser (admin) or not

Returns whether the user is superuser (admin) or not

Returns

boolean
Whether the user is sudo (role = __ROLE_ADMIN__) or not
public static mixed
# isAuthenticated( )

Returns whether the user is authenticated or not. If it is, returns its role (__ROLE_<role>__)

Returns whether the user is authenticated or not. If it is, returns its role (__ROLE_<role>__)

Returns

mixed
FALSE if not authenticated, $role (!= 0) if authenticated
public static mixed
# __callStatic( string $methodName, mixed $args )

Manages all getters, setters and destroyers for Session. Use getFoo(), getFoo('bar') or cleanFoo(). See example for more details and how to use.

Manages all getters, setters and destroyers for Session. Use getFoo(), getFoo('bar') or cleanFoo(). See example for more details and how to use.

Parameters

$methodName
the method to perform. Ex: setUser, getCart
$args
the value

Returns

mixed
$args

Example

Set a variable (any type) with:

Session::setFoo($fooValue)

To read it, use

$foo = Session::getFoo()

To delete a variable, use

$foo = Session::cleanFoo()

(Cleaning a variable returns its value so it can be used as a flash var.)


Properties summary
protected static $roleGuest
# __ROLE_GUEST__
protected static $roleUser
# __ROLE_USER__
protected static $roleAdmin
# __ROLE_ADMIN__
Ribosome API documentation generated by ApiGen