public function import($resource, $prefix = '/', $type = null)
    {
        /** @var RouteCollection[] $collections */
        $collections = $this->load($resource, $type);

        // create a builder from the RouteCollection
        $builder = $this->createBuilder();

        foreach ($collections as $collection) {
            if (null === $collection) {
                continue;
            }

            foreach ($collection->all() as $name => $route) {
                $builder->addRoute($route, $name);
            }

            foreach ($collection->getResources() as $resource) {
                $builder->addResource($resource);
            }
        }

        // mount into this builder
        $this->mount($prefix, $builder);

        return $builder;
    }
public function import($resource, $prefix = '/', $type = null)
    {
        /** @var RouteCollection[] $collections */
        $collections = $this->load($resource, $type);

        // create a builder from the RouteCollection
        $builder = $this->createBuilder();

        foreach ($collections as $collection) {
            if (null === $collection) {
                continue;
            }

            foreach ($collection->all() as $name => $route) {
                $builder->addRoute($route, $name);
            }

            foreach ($collection->getResources() as $resource) {
                $builder->addResource($resource);
            }
        }

        // mount into this builder
        $this->mount($prefix, $builder);

        return $builder;
    }
public function import ( $ resource , $ prefix = '/' , $ type = null ) { /** @var RouteCollection[] $collections */ $ collections = $ this -> load ( $ resource , $ type ) ; // create a builder from the RouteCollection $ builder = $ this -> createBuilder ( ) ; foreach ( $ collections as $ collection ) { if ( null === $ collection ) { continue ; } foreach ( $ collection -> all ( ) as $ name => $ route ) { $ builder -> addRoute ( $ route , $ name ) ; } foreach ( $ collection -> getResources ( ) as $ resource ) { $ builder -> addResource ( $ resource ) ; } } // mount into this builder $ this -> mount ( $ prefix , $ builder ) ; return $ builder ; }
Import an external routing resource and returns the RouteCollectionBuilder.

$routes->import('blog.yml', '/blog');

@param mixed       $resource
@param string|null $prefix
@param string      $type

@return self

@throws LoaderLoadException
Import an external routing resource and returns the RouteCollectionBuilder .