Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 10 |
| MetadataBag | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
30 | |
0.00% |
0 / 10 |
| __construct | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
| setCsrfTokenSeed | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| getCsrfTokenSeed | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 3 |
|||
| clearCsrfTokenSeed | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| <?php | |
| /** | |
| * @file | |
| * Contains \Drupal\Core\Session\MetadataBag. | |
| */ | |
| namespace Drupal\Core\Session; | |
| use Drupal\Core\Site\Settings; | |
| use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag as SymfonyMetadataBag; | |
| /** | |
| * Provides a container for application specific session metadata. | |
| */ | |
| class MetadataBag extends SymfonyMetadataBag { | |
| /** | |
| * The key used to store the CSRF token seed in the session. | |
| */ | |
| const CSRF_TOKEN_SEED = 's'; | |
| /** | |
| * Constructs a new metadata bag instance. | |
| * | |
| * @param \Drupal\Core\Site\Settings $settings | |
| * The settings instance. | |
| */ | |
| public function __construct(Settings $settings) { | |
| $update_threshold = $settings->get('session_write_interval', 180); | |
| parent::__construct('_sf2_meta', $update_threshold); | |
| } | |
| /** | |
| * Set the CSRF token seed. | |
| * | |
| * @param string $csrf_token_seed | |
| * The per-session CSRF token seed. | |
| */ | |
| public function setCsrfTokenSeed($csrf_token_seed) { | |
| $this->meta[static::CSRF_TOKEN_SEED] = $csrf_token_seed; | |
| } | |
| /** | |
| * Get the CSRF token seed. | |
| * | |
| * @return string|null | |
| * The per-session CSRF token seed or null when no value is set. | |
| */ | |
| public function getCsrfTokenSeed() { | |
| if (isset($this->meta[static::CSRF_TOKEN_SEED])) { | |
| return $this->meta[static::CSRF_TOKEN_SEED]; | |
| } | |
| } | |
| /** | |
| * Clear the CSRF token seed. | |
| */ | |
| public function clearCsrfTokenSeed() { | |
| unset($this->meta[static::CSRF_TOKEN_SEED]); | |
| } | |
| } |