/** * Saves the session. * * @return void * * @throws \YapepBase\Exception\Exception If trying to save a not loaded session */ public function saveSession() { if (!$this->isLoaded) { throw new Exception('Saving a session that has not been loaded yet'); } $this->storage->set($this->getStorageKey(), $this->data, $this->lifetime); }
/** * Stores the given data * * @param string $data The data should be stored. * * @return void */ private function setToStorage($data) { if ($this->storage === null) { return; } $this->storage->set($this->storageKey, (string) $data, $this->storageTtl); }
/** * Called at script shutdown if the shutdown is because of a fatal error. * * @param int $errorLevel The error code {@uses E_*} * @param string $message The error message. * @param string $file The file where the error occured. * @param int $line The line in the file where the error occured. * @param string $errorId The internal ID of the error. * * @return void */ public function handleShutdown($errorLevel, $message, $file, $line, $errorId) { if (false !== $this->storage->get($errorId)) { // Only save the debug info, if it's not already saved return; } $helper = new ErrorHandlerHelper(); $errorLevelDescription = $helper->getPhpErrorLevelDescription($errorLevel); $errorMessage = '[' . $errorLevelDescription . '(' . $errorLevel . ')]: ' . $message . ' on line ' . $line . ' in ' . $file; $this->storage->set($errorId, $this->getDebugData($errorId, $errorMessage)); }