protected function setSessionData(string $key, $val)
    {
        if (method_exists($this->getSession(), 'put')) {
            return $this->getSession()->put($key, $val);
        } elseif (method_exists($this->getSession(), 'set')) {
            return $this->getSession()->set($key, $val);
        } elseif (method_exists($this->getSession(), 'write')) {
            return $this->getSession()->write($key, $val);
        }

        return false;
    }