grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026 $value) { if (is_integer($key)) { // is indexed? $result[] = $value; } elseif (isset($result[$key]) && is_array($value) && is_array($result[$key])) { // is associative? $result[$key] = self::arrayMerge([$result[$key], $value]); } else { $result[$key] = $value; } } } return $result; } /** * include and merge custom arrays (custom file should return an array) * * @param array $array * @param string $customFile * @return array * @throws Exception */ public static function mergeCustomArray($array, $customFile) { self::getLastError(); $customFile = self::$customPath . $customFile; if (!file_exists($customFile)) { self::$lastError = self::ERR_FILE_NOT_FOUND; LoggerManager::getLogger()->debug('Custom file is not exists: ' . $customFile); } else { $customs = include $customFile; if (!is_array($customs)) { throw new Exception('Custom file should return an array.', self::ERR_WRONG_CUSTOM_FORMAT); } $array = self::arrayMerge([$array, $customs]); } return $array; } /** * * @param App $app * @return App */ public static function loadCustomRoutes(App $app, $customRoutesFile = 'Config/routes.php') { self::getLastError(); $customRoutesFile = self::$customPath . $customRoutesFile; if (!file_exists($customRoutesFile)) { self::$lastError = self::ERR_ROUTE_FILE_NOT_FOUND; LoggerManager::getLogger()->debug('Custom routes file is not exists: ' . $customRoutesFile); } else { include $customRoutesFile; } return $app; } }