]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Session/Type/AbstractSession.php
Merge pull request #12021 from nupplaphil/feat/session_util
[friendica.git] / src / Core / Session / Type / AbstractSession.php
index 832155741c2df39982fd5f78c17a8e86547c21d3..0e2f884a327c1f0cea5155e7de9ad8991575ef70 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -52,6 +52,20 @@ class AbstractSession implements IHandleSessions
                return $_SESSION[$name] ?? $defaults;
        }
 
+       /**
+        * {@inheritDoc}
+        */
+       public function pop(string $name, $defaults = null)
+       {
+               $value = $defaults;
+               if ($this->exists($name)) {
+                       $value = $this->get($name);
+                       $this->remove($name);
+               }
+
+               return $value;
+       }
+
        /**
         * {@inheritDoc}
         */