<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Config; use Illuminate\Support\Str; class MemberHomeIcon { private static $menu = array(); public static function register($BXiBs) { self::$menu[] = $BXiBs; } public static function get() { goto GLQc8; giyif: $BXiBs = self::mergeMenu($BXiBs); goto w72oZ; w72oZ: return $BXiBs; goto zCBHv; JUTIT: foreach (self::$menu as $Z32UA) { if ($Z32UA instanceof \Closure) { $Z32UA = call_user_func($Z32UA); } $BXiBs = array_merge($BXiBs, $Z32UA); } goto giyif; GLQc8: $BXiBs = array(); goto JUTIT; zCBHv: } private static function sort() { static $S0SDS = 1000; return $S0SDS++; } private static function mergeMenu($BXiBs, $CDU3A = '', $JA4Iq = 1, $wPpmz = null) { goto vDzWR; oElPg: $dmyJT = array(); goto u3k9r; vDzWR: if (empty($BXiBs)) { return array(); } goto oElPg; kFzib: if ($JA4Iq == 1) { uasort($dmyJT, function ($CMJ6j, $Ct6yy) { return $CMJ6j['sort'] - $Ct6yy['sort']; }); return self::mergeMenuTree($dmyJT); } goto K8Qqj; u3k9r: foreach ($BXiBs as $Z32UA) { goto KiCUj; RXsgw: if (!isset($dmyJT[$MFVkb])) { $dmyJT[$MFVkb] = $Z32UA; } goto HqkPe; KiCUj: if (empty($Z32UA)) { continue; } goto tiAUA; ZA0o_: if (1 == $JA4Iq) { $MFVkb = $CDU3A . $Z32UA['title'] . '^' . $Z32UA['sort']; } else { $MFVkb = $CDU3A . $Z32UA['title']; } goto RXsgw; HqkPe: unset($dmyJT[$MFVkb]['children']); goto YLzDg; Nwgj_: if (!isset($Z32UA['sort'])) { $Z32UA['sort'] = self::sort(); } goto ZA0o_; YLzDg: if (!empty($Z32UA['children'])) { $dmyJT = array_merge($dmyJT, self::mergeMenu($Z32UA['children'], $MFVkb . '^^', $JA4Iq + 1, $wPpmz)); } goto fmrSt; tiAUA: if ($wPpmz) { if (!call_user_func($wPpmz, $Z32UA)) { continue; } } goto Nwgj_; fmrSt: } goto kFzib; K8Qqj: return $dmyJT; goto SVZJr; SVZJr: } private static function mergeMenuTree($d37S3, $CDU3A = '') { goto nR3hf; eQH4x: foreach ($d37S3 as $MFVkb => $YxV2x) { goto TfmLV; d1HPl: if (empty($Z32UA['children'])) { unset($Z32UA['children']); } goto Be5ht; TfmLV: if ($MFVkb === $CDU3A) { continue; } goto lGRZ8; yfNhr: if ($CDU3A) { if (!Str::startsWith($MFVkb, $CDU3A)) { continue; } if (count(explode('^^', $CDU3A)) !== count(explode('^^', $MFVkb))) { continue; } } else { if (1 != count($BsTZ_)) { continue; } } goto RGqMp; Be5ht: if (empty($Z32UA['children']) && empty($Z32UA['url'])) { continue; } goto iOBjE; iOBjE: $xrR0s[] = $Z32UA; goto Cze2E; RGqMp: $Z32UA = $YxV2x; goto PVSJN; lGRZ8: $BsTZ_ = explode('^^', $MFVkb); goto yfNhr; PVSJN: $Z32UA['children'] = self::mergeMenuTree($d37S3, $MFVkb . '^^'); goto d1HPl; Cze2E: } goto rEGjl; rEGjl: return $xrR0s; goto S30hF; nR3hf: $xrR0s = array(); goto eQH4x; S30hF: } }