File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 1111 */
1212namespace Hyperf \HttpMessage \Server ;
1313
14+ use Hyperf \Coroutine \Exception \InvalidArgumentException ;
1415use Psr \Http \Message \ResponseInterface ;
1516use Psr \Http \Message \StreamInterface ;
1617use Stringable ;
@@ -27,6 +28,24 @@ public function __toString(): string
2728 return $ this ->toString ();
2829 }
2930
31+ public function __call (string $ name , array $ arguments )
32+ {
33+ if (str_starts_with ($ name , 'with ' )) {
34+ return new static ($ this ->response ->{$ name }(...$ arguments ));
35+ }
36+
37+ if (str_starts_with ($ name , 'get ' )) {
38+ return $ this ->response ->{$ name }(...$ arguments );
39+ }
40+
41+ if (str_starts_with ($ name , 'set ' )) {
42+ $ this ->response ->{$ name }(...$ arguments );
43+ return $ this ;
44+ }
45+
46+ throw new InvalidArgumentException (sprintf ('The method %s is not supported. ' , $ name ));
47+ }
48+
3049 public function getProtocolVersion (): string
3150 {
3251 return $ this ->response ->getProtocolVersion ();
You can’t perform that action at this time.
0 commit comments