From 90a5822a08d946f1c2c4cb2aad34c922a1f5480c Mon Sep 17 00:00:00 2001 From: augushong Date: Wed, 16 Nov 2022 16:25:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E5=87=8F=E6=97=A0=E7=94=A8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 28 ---------------------------- app/common/command/build/Dist.php | 2 +- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/app/common.php b/app/common.php index f9da3e2..38e72c8 100644 --- a/app/common.php +++ b/app/common.php @@ -268,31 +268,3 @@ function build_upload_url($url, $upload_type = null) } return Filesystem::disk($upload_type)->url($url); } - - -/** - * @param $input [需要修改的数组] - * @param $offset [插入的起始位置或键名后] - * @param $length [插入的长度或键名前] - * @param $replacement [需要插入的元素(array、string....)] - * @return array - */ -function array_splice_assoc(&$input, $offset, $length = 0, $replacement = array()) -{ - $replacement = (array)$replacement; - $key_indices = array_flip(array_keys($input)); - - if (isset($input [$offset]) & is_string($offset)) { - $offset = $key_indices [$offset]; - } - if (isset($input[$length]) && is_string($length)) { - $length = $key_indices [$length] - $offset; - } - - // 先取出添加位置之前的元素与要添加的元素合并,再取添加位置之后的元素再合并 - $result = array_slice($input, 0, $offset, TRUE) - + $replacement - + array_slice($input, $offset + $length, NULL, TRUE); - - return $result; -} diff --git a/app/common/command/build/Dist.php b/app/common/command/build/Dist.php index f026742..5d47f5c 100644 --- a/app/common/command/build/Dist.php +++ b/app/common/command/build/Dist.php @@ -229,7 +229,7 @@ class Dist extends Command } if ($namsepace_count !== 1) { - throw new \Exception('一个文件至少有一个命名空间:' . $name); + throw new \Exception('一个文件只能有一个命名空间:' . $name); } if ($class_count !== 1) { throw new \Exception('一个文件只能有一个类:' . $name);