コード例 #1
0
ファイル: Session.php プロジェクト: p810/amethyst
 /**
  * Sets the session handling strategy and calls session_start().
  *
  * A strategy class must implement SessionHandlerInterface.
  *
  * If your strategy utilizes a database it must adhere to the schema defined by Amethyst. In a later version, a SQL file
  * will be included in the Strategy namespace beneath this one.
  *
  * @param string $strategy The name of the class belonging to the namespace p810\Amethyst\Session\Strategy.
  * @see <http://php.net/manual/en/class.sessionhandlerinterface.php>
  * @see <http://php.net/manual/en/function.session-start.php>
  * @return void
  */
 function __construct($strategy)
 {
     $app = Application::getInstance();
     $this->strategy = $app->resolve('Session.Strategy.' . $strategy);
     session_set_save_handler($this->strategy, true);
     session_start();
 }
コード例 #2
0
ファイル: MySQL.php プロジェクト: p810/amethyst
 /**
  * Declares the table where session data is meant to be stored and resolves an instance of p810\Amethyst\Database\MySQL.
  *
  * @param string $table The table which holds session data.
  * @return void
  */
 function __construct($table = 'sessions')
 {
     $app = Application::getInstance();
     $this->database = $app->single('Database.MySQL');
     $this->table = $table;
 }
コード例 #3
0
ファイル: Collection.php プロジェクト: p810/amethyst
 /**
  * Resolves an instance of p810\Amethyst\Router\Translator.
  *
  * @return void
  */
 function __construct()
 {
     $app = Application::getInstance();
     $this->translator = $app->resolve('Router.Translator');
 }