改名
This commit is contained in:
+29
-6
@@ -19,10 +19,10 @@ class GiiInterceptor extends GiiBase
|
||||
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
* @return bool|array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function generate(): array
|
||||
public function generate(): bool|array
|
||||
{
|
||||
|
||||
$managerName = $this->input->get('name', null);
|
||||
@@ -34,12 +34,24 @@ class GiiInterceptor extends GiiBase
|
||||
|
||||
namespace App\Http\Interceptor;
|
||||
|
||||
';
|
||||
$file = APP_PATH . 'app/Http/Interceptor/' . $managerName . 'Interceptor.php';
|
||||
if (file_exists($file)) {
|
||||
try {
|
||||
$class = new \ReflectionClass('App\\Http\\Interceptor\\' . $managerName . 'Interceptor');
|
||||
|
||||
$html .= $this->getImports($file, $class);
|
||||
} catch (\Throwable $exception) {
|
||||
return logger()->addError($exception);
|
||||
}
|
||||
} else {
|
||||
$html .= '
|
||||
use Closure;
|
||||
use HttpServer\Http\Request;
|
||||
use HttpServer\IInterface\Interceptor;
|
||||
|
||||
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
$managerName = ucfirst($managerName);
|
||||
$html .= '
|
||||
@@ -48,7 +60,17 @@ use HttpServer\IInterface\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
|
||||
@@ -62,8 +84,9 @@ class ' . $managerName . 'Interceptor implements Interceptor
|
||||
|
||||
|
||||
}';
|
||||
}
|
||||
|
||||
|
||||
$file = APP_PATH . 'app/Http/Interceptor/' . $managerName . 'Interceptor.php';
|
||||
if (file_exists($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user