<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Config; use Illuminate\Support\Str; class MemberHomeIcon { private static $menu = array(); public static function register($jSsIt) { self::$menu[] = $jSsIt; } public static function get() { goto UN3XD; z3eos: $jSsIt = self::mergeMenu($jSsIt); goto MPGmg; MPGmg: return $jSsIt; goto oFvaz; UN3XD: $jSsIt = array(); goto WhMnH; WhMnH: foreach (self::$menu as $YaV4m) { if ($YaV4m instanceof \Closure) { $YaV4m = call_user_func($YaV4m); } $jSsIt = array_merge($jSsIt, $YaV4m); } goto z3eos; oFvaz: } private static function sort() { static $pPq0i = 1000; return $pPq0i++; } private static function mergeMenu($jSsIt, $aeXlE = '', $tU4nB = 1, $mHisM = null) { goto FdT0Q; qaJFt: if ($tU4nB == 1) { uasort($yyjth, function ($aVDlj, $jyPL0) { return $aVDlj['sort'] - $jyPL0['sort']; }); return self::mergeMenuTree($yyjth); } goto bCPkO; bCPkO: return $yyjth; goto APoTY; RU_Xv: $yyjth = array(); goto dQfLs; FdT0Q: if (empty($jSsIt)) { return array(); } goto RU_Xv; dQfLs: foreach ($jSsIt as $YaV4m) { goto E5358; cU1iX: unset($yyjth[$KAKiA]['children']); goto sBzj3; sBzj3: if (!empty($YaV4m['children'])) { $yyjth = array_merge($yyjth, self::mergeMenu($YaV4m['children'], $KAKiA . '^^', $tU4nB + 1, $mHisM)); } goto BYZax; E5358: if (empty($YaV4m)) { continue; } goto ZX_fW; WEgli: if (1 == $tU4nB) { $KAKiA = $aeXlE . $YaV4m['title'] . '^' . $YaV4m['sort']; } else { $KAKiA = $aeXlE . $YaV4m['title']; } goto kQQaZ; xKDVg: if (!isset($YaV4m['sort'])) { $YaV4m['sort'] = self::sort(); } goto WEgli; kQQaZ: if (!isset($yyjth[$KAKiA])) { $yyjth[$KAKiA] = $YaV4m; } goto cU1iX; ZX_fW: if ($mHisM) { if (!call_user_func($mHisM, $YaV4m)) { continue; } } goto xKDVg; BYZax: } goto qaJFt; APoTY: } private static function mergeMenuTree($Jomtk, $aeXlE = '') { goto EPOYR; EPOYR: $g8_Ju = array(); goto a41w3; a41w3: foreach ($Jomtk as $KAKiA => $Iim2u) { goto lgt5L; k6PAQ: $YaV4m['children'] = self::mergeMenuTree($Jomtk, $KAKiA . '^^'); goto kehR7; WunWo: $w9KQq = explode('^^', $KAKiA); goto GalTa; GalTa: if ($aeXlE) { if (!Str::startsWith($KAKiA, $aeXlE)) { continue; } if (count(explode('^^', $aeXlE)) !== count(explode('^^', $KAKiA))) { continue; } } else { if (1 != count($w9KQq)) { continue; } } goto gR2LG; nq4dF: $g8_Ju[] = $YaV4m; goto jVKJ0; gR2LG: $YaV4m = $Iim2u; goto k6PAQ; lgt5L: if ($KAKiA === $aeXlE) { continue; } goto WunWo; aEOvw: if (empty($YaV4m['children']) && empty($YaV4m['url'])) { continue; } goto nq4dF; kehR7: if (empty($YaV4m['children'])) { unset($YaV4m['children']); } goto aEOvw; jVKJ0: } goto QQWNC; QQWNC: return $g8_Ju; goto EXlUp; EXlUp: } }