public function addParentNamePrefix(RouteCollection $collection, $namePrefix)
    {
        if (!isset($namePrefix) || '' === ($namePrefix = trim($namePrefix))) {
            return $collection;
        }

        $iterator = $collection->getIterator();

        foreach ($iterator as $key1 => $route1) {
            $collection->add($namePrefix.$key1, $route1);
            $collection->remove($key1);
        }

        return $collection;
    }
public function addParentNamePrefix(RouteCollection $collection, $namePrefix)
    {
        if (!isset($namePrefix) || '' === ($namePrefix = trim($namePrefix))) {
            return $collection;
        }

        $iterator = $collection->getIterator();

        foreach ($iterator as $key1 => $route1) {
            $collection->add($namePrefix.$key1, $route1);
            $collection->remove($key1);
        }

        return $collection;
    }
public function addParentNamePrefix ( RouteCollection $ collection , $ namePrefix ) { if ( ! isset ( $ namePrefix ) || '' === ( $ namePrefix = trim ( $ namePrefix ) ) ) { return $ collection ; } $ iterator = $ collection -> getIterator ( ) ; foreach ( $ iterator as $ key1 => $ route1 ) { $ collection -> add ( $ namePrefix . $ key1 , $ route1 ) ; $ collection -> remove ( $ key1 ) ; } return $ collection ; }
Adds a name prefix to the route name of all collection routes.

@param RouteCollection $collection Route collection
@param array           $namePrefix NamePrefix to add in each route name of the route collection

@return RouteCollection
Adds a name prefix to the route name of all collection routes .