/**
* Iterates over $restRouteCollection, and returns the corresponding RouteCollection of OPTIONS REST routes
*
* @param RouteCollection $restRouteCollection
* @return RouteCollection
*/
public function mapCollection(RouteCollection $restRouteCollection)
{
$optionsRouteCollection = new RouteCollection();
foreach ($restRouteCollection->all() as $restRoute) {
$optionsRouteName = $this->mapper->getOptionsRouteName($restRoute);
$optionsRoute = $optionsRouteCollection->get($optionsRouteName);
if ($optionsRoute === null) {
$optionsRoute = $this->mapper->mapRoute($restRoute);
} else {
$optionsRoute = $this->mapper->mergeMethodsDefault($optionsRoute, $restRoute);
}
$optionsRouteCollection->add($optionsRouteName, $optionsRoute);
}
return $optionsRouteCollection;
}