Back to JoomlaStorage class

Method set

public mixed
set
(string $name, mixed $value = null)
Set data into the session store
Parameters
  • string $name Name of a variable.
  • mixed $value Value of a variable.
Returns
  • mixed Old value of a variable.
Since
  • 4.0.0
Class: JoomlaStorage
Project: Joomla

Method set - Source code

/**
 * Set data into the session store
 *
 * @param   string  $name   Name of a variable.
 * @param   mixed   $value  Value of a variable.
 *
 * @return  mixed  Old value of a variable.
 *
 * @since   4.0.0
 */
public function set(string $name, $value = null)
{
    if (!$this->isStarted()) {
        $this->start();
    }
    $old = $this->data->get($name);
    $this->data->set($name, $value);
    return $old;
}