update 2024-05-16 16:19:46
This commit is contained in:
parent
84ef5ae035
commit
d3573db90e
|
@ -13,6 +13,7 @@
|
|||
abstract ActiveRegistry #Orange {
|
||||
# array $active
|
||||
# bool $addAsArray
|
||||
# bool $uniqueArray
|
||||
+ isActive() : bool
|
||||
+ allActive() : array
|
||||
+ setActive(mixed $value, $keys) : void
|
||||
|
|
|
@ -40,6 +40,14 @@ abstract class ActiveRegistry implements Activeregistryinterface
|
|||
**/
|
||||
protected bool $addAsArray = false;
|
||||
|
||||
/**
|
||||
* Base switch to keep array values unique
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.2.2
|
||||
**/
|
||||
protected bool $uniqueArray = false;
|
||||
|
||||
/**
|
||||
* Check if the registry has any content.
|
||||
*
|
||||
|
@ -157,7 +165,16 @@ abstract class ActiveRegistry implements Activeregistryinterface
|
|||
// Convert to array if it's not already an array
|
||||
$array = [$array];
|
||||
}
|
||||
$array[] = $value;
|
||||
|
||||
if ($this->uniqueArray && in_array($value, $array))
|
||||
{
|
||||
// we do nothing
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$array[] = $value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -14,6 +14,14 @@
|
|||
**/
|
||||
protected bool $addAsArray = false;
|
||||
|
||||
/**
|
||||
* Base switch to keep array values unique
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.2.2
|
||||
**/
|
||||
protected bool $uniqueArray = false;
|
||||
|
||||
/**
|
||||
* Check if the registry has any content.
|
||||
*
|
||||
|
@ -131,7 +139,16 @@
|
|||
// Convert to array if it's not already an array
|
||||
$array = [$array];
|
||||
}
|
||||
$array[] = $value;
|
||||
|
||||
if ($this->uniqueArray && in_array($value, $array))
|
||||
{
|
||||
// we do nothing
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$array[] = $value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user