Skip to content

Commit e645ea1

Browse files
committed
#126 remove unused priority handling from cache control subscriber
1 parent db41aa3 commit e645ea1

File tree

1 file changed

+3
-24
lines changed

1 file changed

+3
-24
lines changed

EventListener/AbstractRuleSubscriber.php

+3-24
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,12 @@ class AbstractRuleSubscriber
2828
*
2929
* @param RuleMatcherInterface $ruleMatcher The headers apply to responses matched by this matcher.
3030
* @param array $settings An array of header configuration.
31-
* @param int $priority Optional priority of this matcher. Higher priority is applied first.
3231
*/
3332
public function addRule(
3433
RuleMatcherInterface $ruleMatcher,
35-
array $settings = array(),
36-
$priority = 0
34+
array $settings = array()
3735
) {
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);
4237
}
4338

4439
/**
@@ -51,28 +46,12 @@ public function addRule(
5146
*/
5247
protected function matchRule(Request $request, Response $response)
5348
{
54-
foreach ($this->getRules() as $elements) {
49+
foreach ($this->rulesMap as $elements) {
5550
if ($elements[0]->matches($request, $response)) {
5651
return $elements[1];
5752
}
5853
}
5954

6055
return false;
6156
}
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-
}
7857
}

0 commit comments

Comments
 (0)