44
55namespace Qiutuleng \HyperfDumpServer ;
66
7+ use Hyperf \Coroutine \Coroutine ;
78use Hyperf \HttpMessage \Uri \Uri ;
89use Hyperf \HttpServer \Request ;
910use Hyperf \HttpServer \Router \Dispatched ;
@@ -25,7 +26,7 @@ class RequestContextProvider implements ContextProviderInterface
2526 /**
2627 * The variable cloner.
2728 *
28- * @var \Symfony\Component\VarDumper\Cloner\ VarCloner
29+ * @var VarCloner
2930 */
3031 private $ cloner ;
3132
@@ -56,7 +57,7 @@ public function getContext(): ?array
5657 'uri ' => $ this ->getUri (),
5758 'method ' => $ this ->currentRequest ->getMethod (),
5859 'controller ' => $ this ->getController (),
59- 'identifier ' => \ Hyperf \ Utils \ Coroutine::inCoroutine ()
60+ 'identifier ' => Coroutine::inCoroutine ()
6061 ? spl_object_hash (Context::get (ServerRequestInterface::class))
6162 : Str::random (), // TODO: 非协程模式下,暂时未找到合适的唯一对象,先用随机数代替,缺陷是每次都会执行$io->section
6263 ];
@@ -92,7 +93,14 @@ protected function getController()
9293 $ callback = $ this ->transformRouteArrayAction ($ callback );
9394 }
9495
95- return $ this ->cloner ->cloneVar (class_basename ($ callback ));
96+ return $ this ->cloner ->cloneVar (
97+ basename (
98+ str_replace (
99+ '\\' ,
100+ '/ ' ,
101+ (is_object ($ callback ) ? get_class ($ callback ) : $ callback ))
102+ )
103+ );
96104 }
97105
98106 protected function transformRouteArrayAction (array $ action ): string
0 commit comments