public function hasSessionBagFlag(Request
$request) { /** @var \Drupal\session_test\Session\TestSessionBag */
$bag =
$request->
getSession()->
getBag(TestSessionBag::BAG_NAME
);
return new Response(empty($bag->
hasFlag()) ?
$this->
t('Flag is absent from session bag'
) :
$this->
t('Flag is present in session bag'
) );
}}