LSerror::getErrors(): add $reset parameter

This commit is contained in:
Benjamin Renard 2023-05-26 09:40:28 +02:00
parent c98e31b7c6
commit 087b7e3065
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -100,17 +100,20 @@ class LSerror {
/**
* Format current errors message
*
* @param bool $reset Reset errors (optional, default: true)
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @return array Array of formated error messages
*/
public static function getErrors() {
public static function getErrors($reset=true) {
$return = (
self :: errorsDefined()?
$_SESSION['LSerror']:
array()
);
self :: resetError();
if ($reset)
self :: resetError();
return $return;
}