@@ -28,17 +28,12 @@ class AbstractRuleSubscriber
28
28
*
29
29
* @param RuleMatcherInterface $ruleMatcher The headers apply to responses matched by this matcher.
30
30
* @param array $settings An array of header configuration.
31
- * @param int $priority Optional priority of this matcher. Higher priority is applied first.
32
31
*/
33
32
public function addRule (
34
33
RuleMatcherInterface $ ruleMatcher ,
35
- array $ settings = array (),
36
- $ priority = 0
34
+ array $ settings = array ()
37
35
) {
38
- if (!isset ($ this ->rulesMap [$ priority ])) {
39
- $ this ->rulesMap [$ priority ] = array ();
40
- }
41
- $ this ->rulesMap [$ priority ][] = array ($ ruleMatcher , $ settings );
36
+ $ this ->rulesMap [] = array ($ ruleMatcher , $ settings );
42
37
}
43
38
44
39
/**
@@ -51,28 +46,12 @@ public function addRule(
51
46
*/
52
47
protected function matchRule (Request $ request , Response $ response )
53
48
{
54
- foreach ($ this ->getRules () as $ elements ) {
49
+ foreach ($ this ->rulesMap as $ elements ) {
55
50
if ($ elements [0 ]->matches ($ request , $ response )) {
56
51
return $ elements [1 ];
57
52
}
58
53
}
59
54
60
55
return false ;
61
56
}
62
-
63
- /**
64
- * Get the rules ordered by priority.
65
- *
66
- * @return RuleMatcherInterface[] of array with rule matcher, settings
67
- */
68
- private function getRules ()
69
- {
70
- $ sortedRules = array ();
71
- krsort ($ this ->rulesMap );
72
- foreach ($ this ->rulesMap as $ rules ) {
73
- $ sortedRules = array_merge ($ sortedRules , $ rules );
74
- }
75
-
76
- return $ sortedRules ;
77
- }
78
57
}
0 commit comments