@@ -37,34 +37,30 @@ class ServerRequest
3737 */
3838 function __construct ($ config = [])
3939 {
40- !isset ($ config [SERVER ]) &&
41- $ config [SERVER ] = normalizeServer ($ _SERVER );
40+ $ config [SERVER ] ??= normalizeServer ($ _SERVER );
4241
4342 $ server = $ config [SERVER ];
4443
45- !isset ($ config [HEADERS ]) &&
46- $ config [HEADERS ] = marshalHeadersFromSapi ($ server );
44+ $ config [HEADERS ] ??= marshalHeadersFromSapi ($ server );
4745
4846 is_array ($ config [HEADERS ]) &&
4947 $ config [HEADERS ] = new HttpHeaders ($ config [HEADERS ]);
5048
51- !isset ($ config [URI ]) &&
52- $ config [URI ] = new Uri (marshalUriFromSapi ($ server , $ config [HEADERS ]->all ()));
49+ $ config [URI ] ??= new Uri (marshalUriFromSapi ($ server , $ config [HEADERS ]->all ()));
5350
54- !isset ($ config [COOKIES ]) &&
55- $ config [COOKIES ] = new HttpCookies (isset ($ config [HEADERS ]['cookie ' ]) ?
56- parseCookieHeader ($ config [HEADERS ]['cookie ' ]) : $ _COOKIE );
51+ $ config [COOKIES ] ??= new HttpCookies (isset ($ config [HEADERS ]['cookie ' ]) ?
52+ parseCookieHeader ($ config [HEADERS ]['cookie ' ]) : $ _COOKIE );
5753
5854 is_array ($ config [COOKIES ]) &&
5955 $ config [COOKIES ] = new HttpCookies ($ config [COOKIES ]);
6056
61- ! isset ( $ config [ARGS ]) && $ config [ ARGS ] = $ _GET ;
62- ! isset ( $ config [ATTRIBUTES ]) && $ config [ ATTRIBUTES ] = [];
63- ! isset ( $ config [BODY ]) && $ config [ BODY ] = new PhpInputStream ;
64- ! isset ( $ config [DATA ]) && $ config [ DATA ] = $ _POST ;
65- ! isset ( $ config [FILES ]) && $ config [ FILES ] = normalizeUploadedFiles ($ _FILES );
66- ! isset ( $ config [METHOD ]) && $ config [ METHOD ] = $ server ['REQUEST_METHOD ' ] ?? 'GET ' ;
67- ! isset ( $ config [VERSION ]) && $ config [ VERSION ] = substr ($ server ['SERVER_PROTOCOL ' ] ?? 'HTTP/1.1 ' , strlen ('HTTP/ ' ));
57+ $ config [ARGS ] ?? = $ _GET ;
58+ $ config [ATTRIBUTES ] ?? = [];
59+ $ config [BODY ] ?? = new PhpInputStream ;
60+ $ config [DATA ] ?? = $ _POST ;
61+ $ config [FILES ] ?? = normalizeUploadedFiles ($ _FILES );
62+ $ config [METHOD ] ?? = $ server ['REQUEST_METHOD ' ] ?? 'GET ' ;
63+ $ config [VERSION ] ?? = substr ($ server ['SERVER_PROTOCOL ' ] ?? 'HTTP/1.1 ' , strlen ('HTTP/ ' ));
6864
6965 parent ::__construct ($ config );
7066 }
0 commit comments