File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 66 " library" , " helper" , " support"
77 ],
88 "type" : " library" ,
9- "version" : " 1.0.0" ,
109 "homepage" : " https://github.com/nabeghe/reflecty-php" ,
1110 "license" : " MIT" ,
1211 "autoload" : {
Original file line number Diff line number Diff line change @@ -12,32 +12,38 @@ protected static function init()
1212 {
1313 if (!isset (static ::$ headers )) {
1414 $ headers = getallheaders ();
15- if (!is_array ($ headers )) {
15+ if (is_array ($ headers )) {
16+ $ headers = array_change_key_case ($ headers );
17+ } else {
1618 $ headers = [];
1719 }
20+
1821 static ::$ headers = $ headers ;
1922 }
2023 }
2124
2225 public static function all (): array
2326 {
2427 static ::init ();
28+
2529 return static ::$ headers ;
2630 }
2731
2832 public static function get ($ name , $ default = null )
2933 {
3034 static ::init ();
3135
32- if (isset (static ::$ headers [$ name ])) {
33- return static ::$ headers [$ name ];
36+ $ lower_name = strtolower ($ name );
37+
38+ if (isset (static ::$ headers [$ lower_name ])) {
39+ return static ::$ headers [$ lower_name ];
3440 }
3541
3642 if (func_num_args () > 1 ) {
3743 return $ default ;
3844 }
3945
40- return static ::DEFAULTS [$ name ] ?? static ::DEFAULT ;
46+ return static ::DEFAULTS [$ lower_name ] ?? static :: DEFAULTS [ $ name ] ?? static ::DEFAULT ;
4147 }
4248
4349 public static function flush ()
You can’t perform that action at this time.
0 commit comments