private function registerRequestMatchingPolicy()
{
$this->container->setDefinition('request.matching_policy.method', function ($container) {
return new MethodMatchingPolicy();
}, ['matching_policy']);
$this->container->setDefinition('request.matching_policy.route', function ($container) {
return new RouteMatchingPolicy();
}, ['matching_policy']);
$this->container->setDefinition('request.matching_policy.parameter', function ($container) {
return new ParameterMatchingPolicy($container->getService('php_matcher'));
}, ['matching_policy']);
$this->container->setDefinition('request.matching_policy.headers', function ($container) {
return new HeadersMatchingPolicy($container->getService('php_matcher'));
}, ['matching_policy']);
$this->container->setDefinition('request.matching_policy.body', function ($container) {
return new BodyMatchingPolicy($container->getService('php_matcher'));
}, ['matching_policy']);
$this->container->setDefinition('request.matching_policy', function ($container) {
$matchingPolicy = new ChainMatchingPolicy();
$matchingPolicies = $container->getServicesByTag('matching_policy');
foreach ($matchingPolicies as $policy) {
$matchingPolicy->addMatchingPolicy($policy);
}
return $matchingPolicy;
});
}