@@ -30,7 +30,7 @@ public static function matchMethod(Request $first, Request $second)
3030 */ 
3131 public  static  function  matchUrl (Request $ firstRequest $ second
3232 {
33-  return  !(( null  !==  $ firstgetPath ())  and  (( string )  $ first -> getPath () != ( string )  $ secondgetPath ()) );
33+  return  $ firstgetPath () ===  $ secondgetPath ();
3434 }
3535
3636 /** 
@@ -43,12 +43,7 @@ public static function matchUrl(Request $first, Request $second)
4343 */ 
4444 public  static  function  matchHost (Request $ firstRequest $ second
4545 {
46-  if  (null  !== $ firstgetHost ()
47-  && !preg_match ('# ' .str_replace ('# ' , '\\# ' , $ firstgetHost ()).'#i ' , $ secondgetHost ())) {
48-  return  false ;
49-  }
50- 
51-  return  true ;
46+  return  $ firstgetHost () === $ secondgetHost ();
5247 }
5348
5449 /** 
@@ -61,15 +56,9 @@ public static function matchHost(Request $first, Request $second)
6156 */ 
6257 public  static  function  matchHeaders (Request $ firstRequest $ second
6358 {
64-  $ firstHeaders$ firstgetHeaders ();
65-  foreach  ($ secondgetHeaders () as  $ key$ pattern
66-  if  (!array_key_exists ($ key$ firstHeaders
67-  || $ pattern$ firstHeaders$ key
68-  return  false ;
69-  }
70-  }
59+  // Use array_filter to ignore headers which are null. 
7160
72-  return  true ;
61+  return  array_filter ( $ first -> getHeaders ()) ===  array_filter ( $ second -> getHeaders ()) ;
7362 }
7463
7564 /** 
@@ -82,11 +71,7 @@ public static function matchHeaders(Request $first, Request $second)
8271 */ 
8372 public  static  function  matchBody (Request $ firstRequest $ second
8473 {
85-  if  (null  !== $ firstgetBody () && (string ) $ firstgetBody () != (string ) $ secondgetBody () ) {
86-  return  false ;
87-  }
88- 
89-  return  true ;
74+  return  $ firstgetBody () === $ secondgetBody ();
9075 }
9176
9277 /** 
@@ -99,11 +84,7 @@ public static function matchBody(Request $first, Request $second)
9984 */ 
10085 public  static  function  matchPostFields (Request $ firstRequest $ second
10186 {
102-  if  (null  !== $ firstgetPostFields () && $ firstgetPostFields () != $ secondgetPostFields ()) {
103-  return  false ;
104-  }
105- 
106-  return  true ;
87+  return  $ firstgetPostFields () === $ secondgetPostFields ();
10788 }
10889
10990 /** 
@@ -116,9 +97,6 @@ public static function matchPostFields(Request $first, Request $second)
11697 */ 
11798 public  static  function  matchQueryString (Request $ firstRequest $ second
11899 {
119-  if  (null  !== $ firstgetQuery () && $ firstgetQuery () != $ secondgetQuery ()) {
120-  return  false ;
121-  }
122-  return  true ;
100+  return  $ firstgetQuery () === $ secondgetQuery ();
123101 }
124102}
0 commit comments