Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
fusiondirectory
fusiondirectory-orchestrator
Commits
41484ce8
Commit
41484ce8
authored
1 month ago
by
Oana-Eliza Alexa
Browse files
Options
Download
Patches
Plain Diff
use maps
parent
6c6ee4a7
78-redesign-audit-class
1 merge request
!74
Draft: Resolve "Redesign audit class"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
library/Utils.php
+8
-18
library/Utils.php
with
8 additions
and
18 deletions
+8
-18
library/Utils.php
+
8
−
18
View file @
41484ce8
...
@@ -13,20 +13,12 @@ class Utils
...
@@ -13,20 +13,12 @@ class Utils
*/
*/
public
static
function
recursiveArrayFilter
(
array
$array
):
array
public
static
function
recursiveArrayFilter
(
array
$array
):
array
{
{
// First filter the array for non-empty elements
return
array_filter
(
$array
,
function
(
$item
)
{
$filtered
=
array_filter
(
$array
,
function
(
$item
)
{
if
(
is_array
(
$item
))
{
if
(
is_array
(
$item
))
{
$item
=
self
::
recursiveArrayFilter
(
$item
);
// Recursively filter the sub-array
}
$item
=
self
::
recursiveArrayFilter
(
$item
);
// Only retain non-empty arrays
return
!
empty
(
$item
);
}
else
{
// Retain non-empty scalar values
return
!
empty
(
$item
);
return
!
empty
(
$item
);
}
});
});
return
$filtered
;
}
}
/**
/**
...
@@ -40,12 +32,10 @@ class Utils
...
@@ -40,12 +32,10 @@ class Utils
{
{
$matching
=
[];
$matching
=
[];
if
(
!
empty
(
$elements
))
{
foreach
(
$elements
as
$element
)
{
foreach
(
$elements
as
$element
)
{
foreach
(
$keys
as
$key
)
{
foreach
(
$keys
as
$key
)
{
if
(
!
empty
(
$element
)
&&
array_key_exists
(
$key
,
$element
))
{
if
(
!
empty
(
$element
)
&&
array_key_exists
(
$key
,
$element
))
{
$matching
[]
=
$key
;
$matching
[]
=
$key
;
}
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets