Skip to content

Commit

Permalink
Update Session.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Nenglish7 committed Jan 1, 2018
1 parent 2e8c8d4 commit 763396d
Showing 1 changed file with 52 additions and 1 deletion.
53 changes: 52 additions & 1 deletion src/Dependent/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,35 @@

namespace Genial\Config\Dependent;

use Genial\Config\Exception;

/**
* Session.
*/
class Session implements DependentInterface, SessionDependentInterface
{

/**
* __construct().
*
* Check to see if the env function exists.
*
* @throws RuntimeException If the env function does not exist.
*
* @return void.
*/
function __construct()
{
if (!function_exists('env'))
{
throw new Exception\RuntimeException(sprintf(
'`%s` The `env()` function does not exist.',
__METHOD__
));
}
$this->config = env('session');
}

/**
* run().
*
Expand All @@ -27,7 +50,35 @@ class Session implements DependentInterface, SessionDependentInterface
*/
public function run()
{

if (isset($this->config['session_name']))
{
session_name($this->config['session_name']);
}
if (isset($this->config['session_encrypt'])
{
$encrypt = true;
}
if ()
{

}

if ($this->config['session_handler'] == 'files'))
{
ini_set('session.save_path', APP_ROOT . '/temp');
if (version_compare(PHP_VERSION, '7.2.0') >= 0)
{
session_gc();
} else
{
ini_set('session.gc_maxlifetime', 0);
}
} elseif (defined('DATABASE_DEPENDENT_ACTIVE') && $this->config['session_handler'] == 'db')
{
$table = env('database', 'table_prefix', 'genial') . '_session';
/* ... */
}

}

}
Expand Down

0 comments on commit 763396d

Please sign in to comment.