File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ class HttpHeaderParser
3333 */
3434 public function parse (string |array $ headers ): EvolvableLinkProviderInterface
3535 {
36- if (is_array ($ headers )) {
36+ if (\ is_array ($ headers )) {
3737 $ headers = implode (', ' , $ headers );
3838 }
3939 $ links = new GenericLinkProvider ();
@@ -59,10 +59,10 @@ public function parse(string|array $headers): EvolvableLinkProviderInterface
5959 default => true ,
6060 };
6161
62- if ($ key === ' rel ' ) {
62+ if (' rel ' === $ key ) {
6363 // Only the first occurrence of the "rel" attribute is read
64- $ rels ??= $ value === true ? [] : preg_split ('/\s+/ ' , $ value , 0 , \PREG_SPLIT_NO_EMPTY );
65- } elseif (is_array ($ attributes [$ key ] ?? null )) {
64+ $ rels ??= true === $ value ? [] : preg_split ('/\s+/ ' , $ value , 0 , \PREG_SPLIT_NO_EMPTY );
65+ } elseif (\ is_array ($ attributes [$ key ] ?? null )) {
6666 $ attributes [$ key ][] = $ value ;
6767 } elseif (isset ($ attributes [$ key ])) {
6868 $ attributes [$ key ] = [$ attributes [$ key ], $ value ];
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ public function testParse()
2323
2424 $ header = [
2525 '</1>; rel="prerender",</2>; rel="dns-prefetch"; pr="0.7",</3>; rel="preload"; as="script" ' ,
26- '</4>; rel="preload"; as="image"; nopush,</5>; rel="alternate next"; hreflang="fr"; hreflang="de"; title="Hello" '
26+ '</4>; rel="preload"; as="image"; nopush,</5>; rel="alternate next"; hreflang="fr"; hreflang="de"; title="Hello" ' ,
2727 ];
2828 $ provider = $ parser ->parse ($ header );
2929 $ links = $ provider ->getLinks ();
You can’t perform that action at this time.
0 commit comments