aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/Minz/Request.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Minz/Request.php')
-rw-r--r--lib/Minz/Request.php24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php
index a5d599a45..b74331146 100644
--- a/lib/Minz/Request.php
+++ b/lib/Minz/Request.php
@@ -385,33 +385,33 @@ class Minz_Request {
return $_GET['rid'];
}
- private static function setNotification(string $type, string $content): void {
+ private static function setNotification(string $type, string $content, string $notificationName = ''): void {
Minz_Session::lock();
$requests = Minz_Session::paramArray('requests');
$requests[self::requestId()] = [
'time' => time(),
- 'notification' => [ 'type' => $type, 'content' => $content ],
+ 'notification' => [ 'type' => $type, 'content' => $content, 'notificationName' => $notificationName ],
];
Minz_Session::_param('requests', $requests);
Minz_Session::unlock();
}
- public static function setGoodNotification(string $content): void {
- self::setNotification('good', $content);
+ public static function setGoodNotification(string $content, string $notificationName = ''): void {
+ self::setNotification('good', $content, $notificationName);
}
- public static function setBadNotification(string $content): void {
- self::setNotification('bad', $content);
+ public static function setBadNotification(string $content, string $notificationName = ''): void {
+ self::setNotification('bad', $content, $notificationName);
}
/**
* @param $pop true (default) to remove the notification, false to keep it.
- * @return array{type:string,content:string}|null
+ * @return array{type:string,content:string,notificationName:string}|null
*/
public static function getNotification(bool $pop = true): ?array {
$notif = null;
Minz_Session::lock();
- /** @var array<string,array{time:int,notification:array{type:string,content:string}}> */
+ /** @var array<string,array{time:int,notification:array{type:string,content:string,notificationName:string}}> */
$requests = Minz_Session::paramArray('requests');
if (!empty($requests)) {
//Delete abandoned notifications
@@ -461,8 +461,8 @@ class Minz_Request {
* @param string $msg notification content
* @param array{c?:string,a?:string,params?:array<string,mixed>} $url url array to where we should be forwarded
*/
- public static function good(string $msg, array $url = []): void {
- Minz_Request::setGoodNotification($msg);
+ public static function good(string $msg, array $url = [], string $notificationName = ''): void {
+ Minz_Request::setGoodNotification($msg, $notificationName);
Minz_Request::forward($url, true);
}
@@ -471,8 +471,8 @@ class Minz_Request {
* @param string $msg notification content
* @param array{c?:string,a?:string,params?:array<string,mixed>} $url url array to where we should be forwarded
*/
- public static function bad(string $msg, array $url = []): void {
- Minz_Request::setBadNotification($msg);
+ public static function bad(string $msg, array $url = [], string $notificationName = ''): void {
+ Minz_Request::setBadNotification($msg, $notificationName);
Minz_Request::forward($url, true);
}