input->get('name', null); if (empty($managerName)) { throw new Exception('文件名称不能为空~'); } $html = 'getImports($file, $class); } catch (\Throwable $exception) { return logger()->addError($exception, 'throwable'); } } else { $html .= ' use Closure; use HttpServer\Http\Request; use HttpServer\IInterface\Interceptor; '; } $managerName = ucfirst($managerName); $html .= ' /** * Class ' . $managerName . 'Interceptor * @package App\Http\Interceptor */ class ' . $managerName . 'Interceptor implements Interceptor {'; if (isset($class)) { $html .= $this->getClassProperty($class); $html .= $this->getClassMethods($class); $html .= ' }'; } else { $html .= ' /** * @param Request $request * @param Closure $closure * @return mixed */ public function Interceptor(Request $request, Closure $closure) { return $closure($request); } }'; } if (file_exists($file)) { throw new Exception('File exists.'); } Snowflake::writeFile($file, $html); return [$managerName . 'Interceptor.php']; } }