Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iqdevTranningProgram
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Адлан Шамавов
iqdevTranningProgram
Merge requests
!4
Ptps controller 4
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Ptps controller 4
PTPS_Controller_4
into
main
Overview
4
Commits
10
Pipelines
0
Changes
4
Merged
Адлан Шамавов
requested to merge
PTPS_Controller_4
into
main
11 months ago
Overview
4
Commits
10
Pipelines
0
Changes
4
Expand
0
0
Merge request reports
Compare
main
version 8
162cb01e
11 months ago
version 7
162cb01e
11 months ago
version 6
bb4d00a6
11 months ago
version 5
dc99cfdb
11 months ago
version 4
dc99cfdb
11 months ago
version 3
e8304f56
11 months ago
version 2
41240ef5
11 months ago
version 1
f47c6e5c
11 months ago
main (base)
and
latest version
latest version
d778f277
10 commits,
11 months ago
version 8
162cb01e
9 commits,
11 months ago
version 7
162cb01e
19 commits,
11 months ago
version 6
bb4d00a6
18 commits,
11 months ago
version 5
dc99cfdb
16 commits,
11 months ago
version 4
dc99cfdb
18 commits,
11 months ago
version 3
e8304f56
17 commits,
11 months ago
version 2
41240ef5
5 commits,
11 months ago
version 1
f47c6e5c
3 commits,
11 months ago
4 files
+
75
−
10
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
src/Action/Functions.php
+
40
−
0
Options
@@ -44,4 +44,44 @@ class Functions
}
return
null
;
}
/**
* Удалить дубликаты, оставив только уникальные значения
* @param array $array
* @return array
*/
public
function
uniqElements
(
array
$array
):
array
{
return
array_unique
(
$array
,
SORT_REGULAR
);
}
/**
* Сгруппировать подразедлы в верхние разделы меню
* Дочерние элементы поместить в массив родителя с ключом submenu
* Значение под ключом depth определяет уровень раздела
* Массив $aMenu всегда начинается с элемента depth = 0,
* все последующие элементы с depth = 1 являются его дочерними
* элементами
* @param array $aMenu
* @return array
*/
public
function
prepareMenu
(
array
$aMenu
):
array
{
$result
=
[];
foreach
(
$aMenu
as
$arr
)
{
if
(
$arr
[
'depth'
]
==
0
)
{
$result
[]
=
array
(
'name'
=>
$arr
[
'name'
],
'depth'
=>
$arr
[
'depth'
],
'submenu'
=>
[]
);
continue
;
}
$result
[
array_key_last
(
$result
)][
'submenu'
][]
=
array
(
'name'
=>
$arr
[
'name'
],
'depth'
=>
$arr
[
'depth'
],
);
}
return
$result
;
}
}
\ No newline at end of file
Loading