# Session

class Session implements Libraries

## Properties

`static protected` | `$instance` |  |

## Methods

`public static` | `` | `create()` | No description |
`protected` | `` | `__construct()` | No description |
`public static` | `` | `has($name)` | No description |
`public static` | `` | `set($name, $value)` | No description |
`public static` | `` | `get($name)` | No description |
`public static` | `` | `remove($name)` | No description |
`public static` | `` | `removeAll()` | No description |

## Details

at line 12

### `create()`

`public static create()`
at line 19

### `__construct()`

`protected __construct()`
at line 21

### `has()`

`public static has($name)`

#### Parameters

| `$name` |

at line 27

### `set()`

`public static set($name, $value)`

#### Parameters

| `$name` |
| `$value` |

at line 33

### `get()`

`public static get($name)`

#### Parameters

| `$name` |

at line 39

### `remove()`

`public static remove($name)`

#### Parameters

| `$name` |

at line 45

### `removeAll()`

`public static removeAll()`

## Source code

    <?php

    	namespace App\Khan\Libraries;
    	use App\Khan\Contracts\Libraries\Libraries as LibrariesContract;

    	@session_start();

    	class Session implements LibrariesContract {

    		protected static $instance = null;

    		public static function create(){
                if(is_null(self::$instance)){
                    self::$instance = new Session();
                }
                return self::$instance;
            }

            protected function __construct(){}

    		public static function has($name){
    			if(isset($_SESSION[$name]) && !empty($_SESSION[$name])){
    				return true;
    			}
    		}

    		public static function set($name, $value){
    			if(!isset($_SESSION[$name]) && empty($_SESSION[$name])){
    				$_SESSION[$name] = $value;
    			}
    		}

    		public static function get($name){
    			if(isset($_SESSION[$name]) && !empty($_SESSION[$name])){
    				return $_SESSION[$name];
    			}
    		}

    		public static function remove($name){
    			if(isset($_SESSION[$name]) && !empty($_SESSION[$name])){
    				unset($_SESSION[$name]);
    			}
    		}

    		public static function removeAll(){
    			session_destroy();
    		}

    	}