From 82655eb332e9eca443e15023481ad68faba4a352 Mon Sep 17 00:00:00 2001 From: Lkeme <19500576+lkeme@users.noreply.github.com> Date: Sat, 1 Oct 2022 15:27:27 +0800 Subject: [PATCH] [update] Profile filter --- src/Console/Console.php | 8 +++++++- src/Schedule/Schedule.php | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Console/Console.php b/src/Console/Console.php index 4005917..2ab612d 100644 --- a/src/Console/Console.php +++ b/src/Console/Console.php @@ -64,9 +64,10 @@ LOGO; * 解析参数 * @param array $argv * @param string $default + * @param array $reserved * @return string */ - public static function parse(array $argv, string $default = 'user'): string + public static function parse(array $argv, string $default = 'user', array $reserved = ['example']): string { try { // backup @@ -83,6 +84,11 @@ LOGO; } catch (Exception $e) { failExit('解析命令行参数错误', ['msg' => $e->getMessage()]); } + // 保留关键字 + if (in_array($filename, $reserved)) { + failExit("不能使用程序保留关键字 {$filename}"); + } + return $filename; } diff --git a/src/Schedule/Schedule.php b/src/Schedule/Schedule.php index 8166f0f..661baa5 100644 --- a/src/Schedule/Schedule.php +++ b/src/Schedule/Schedule.php @@ -66,7 +66,6 @@ class Schedule extends SingleTon return file_put_contents($this->repository, json_encode($data)); } - /** * 写入 * @param string $class @@ -106,4 +105,4 @@ class Schedule extends SingleTon } -} \ No newline at end of file +}