Enhance flag handling for session operations.
This commit is contained in:
parent
fffad01516
commit
1c4621c55b
2 changed files with 24 additions and 4 deletions
|
@ -213,11 +213,24 @@
|
|||
/**
|
||||
* Checks if a given flag exists in the list of session flags.
|
||||
*
|
||||
* @param string|SessionFlags $flag The flag to check, either as a string or a SessionFlags object.
|
||||
* @param string|SessionFlags|array $flag The flag to check, either as a string or a SessionFlags object. If an array is provided, all flags must exist.
|
||||
* @return bool True if the flag exists, false otherwise.
|
||||
*/
|
||||
public function flagExists(string|SessionFlags $flag): bool
|
||||
public function flagExists(string|SessionFlags|array $flag): bool
|
||||
{
|
||||
if(is_array($flag))
|
||||
{
|
||||
foreach($flag as $f)
|
||||
{
|
||||
if(!$this->flagExists($f))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if(is_string($flag))
|
||||
{
|
||||
$flag = SessionFlags::tryFrom($flag);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue