1 | <?php |
||
27 | class Negotiator implements NegotiatorInterface |
||
|
|||
28 | { |
||
29 | /** |
||
30 | * @var PreferenceBuilderInterface |
||
31 | */ |
||
32 | private $prefBuilder; |
||
33 | |||
34 | /** |
||
35 | * @var PreferenceBuilderInterface |
||
36 | */ |
||
37 | private $mimePrefBuilder; |
||
38 | |||
39 | /** |
||
40 | * @var MatcherInterface[] |
||
41 | */ |
||
42 | private $matcherList; |
||
43 | |||
44 | |||
45 | /** |
||
46 | * Constructor. |
||
47 | * |
||
48 | * @param PreferenceBuilderInterface $prefBuilder |
||
49 | * @param PreferenceBuilderInterface $mimePrefBuilder |
||
50 | * @param MatcherInterface[] $matcherList Objects implementing MatcherInterface, matching is attempted in the order |
||
51 | * of the matcher objects in the array. When a match is found no further match tests are done and the testing |
||
52 | * loop will exit. |
||
53 | */ |
||
54 | 76 | public function __construct( |
|
73 | |||
74 | /** |
||
75 | * @inheritDoc |
||
76 | */ |
||
77 | 76 | public function negotiateAll(array $clientPrefList, array $serverPrefList, $fromField) |
|
99 | |||
100 | /** |
||
101 | * @inheritDoc |
||
102 | */ |
||
103 | 36 | public function negotiateBest(array $clientPrefList, array $serverPrefList, $fromField) |
|
119 | |||
120 | /** |
||
121 | * Match client variants to server variants. |
||
122 | * |
||
123 | * @param string $fromField |
||
124 | * @param PreferenceInterface[] $clientPrefList |
||
125 | * @param MatchedPreferenceInterface[] $matchingList |
||
126 | * |
||
127 | * @return MatchedPreferenceInterface[] |
||
128 | */ |
||
129 | 76 | private function matchClientPreferences($fromField, array $clientPrefList, array $matchingList) |
|
137 | |||
138 | /** |
||
139 | * Match a single client variant to the server variants. |
||
140 | * |
||
141 | * @param string $fromField |
||
142 | * @param PreferenceInterface $clientPreference |
||
143 | * @param MatchedPreferenceInterface[] $matchingList |
||
144 | * |
||
145 | * @return MatchedPreferenceInterface[] |
||
146 | */ |
||
147 | 54 | private function matchSingleClientPreference($fromField, PreferenceInterface $clientPreference, array $matchingList) |
|
159 | |||
160 | /** |
||
161 | * Get a preference builder for the specified HTTP field. |
||
162 | * |
||
163 | * @param string $fromField |
||
164 | * |
||
165 | * @return PreferenceBuilderInterface |
||
166 | */ |
||
167 | 76 | private function getBuilder($fromField) |
|
175 | } |
||
176 |