Groups the routes with a prefix and namespace if prefix or namespace is provided.

@param string $stub
@param string $prefix
@param string $namespace

@return $this
171493
protected function processRoutesGroup(&$stub, $prefix, $namespace)
    {
        $prefix = trim($prefix);

        if (!empty($prefix) || !empty($namespace)) {
            $groupStub = $this->getStubContent('routes-group');

            $this->replacePrefix($groupStub, $this->getGroupPrefix($prefix))
                ->replaceRoutes($groupStub, $stub);

            $stub = $groupStub;
        }

        return $this;
    }
281844
private function enterGroup($prefix, array $requirements)
    {
        $group = new RouteGroup($prefix, $requirements, $this->getParentGroup());
        $this->pushGroup($group);

        return $this;
    }
645596
public function prefix($prefix) {
		// Reset values before matching.
		$this->prefix = $this->parentPrefix;
		$this->requestPathOffset = $this->parentRequestPathOffset;
		if ($this->parentPrefixMatched) {
			$this->prefixMatched = $this->parentPrefixMatched;
		}

		if (!$this->result->hasHandler() && $this->prefixMatched) {
			$this->prefixMatched = $this->matchPartial($prefix);
		}

		$this->prefix .= $prefix;

		return $this;
	}
827539
public static function group($prefix, $callback){

      // Skip definition if current request doesn't match group.
      $pre_prefix = rtrim(implode('',static::$prefix),'/');
      $URI   = Request::URI();
      $args  = [];
      $group = false;

      switch (true) {

        // Dynamic group
        case static::isDynamic($prefix) :
          $args = static::extractVariablesFromURL($prx=static::compilePatternAsRegex("$pre_prefix$prefix"), null, true);
          if ( $args !== false ) {
            // Burn-in $prefix as static string
            $partial = preg_match_all(str_replace('$#', '#', $prx), $URI, $partial) ? $partial[0][0] : '';
            $prefix = $partial ? preg_replace('#^'.implode('',static::$prefix).'#', '', $partial) : $prefix;
          }

        // Static group
        case ( 0 === strpos("$URI/", "$pre_prefix$prefix/") )
             || ( ! Options::get('core.route.pruning', true) ) :

          static::$prefix[] = $prefix;
          if (empty(static::$group)) static::$group = [];
          array_unshift(static::$group, $group = new RouteGroup());

          // Call the group body function
          call_user_func_array($callback, $args ?: []);

          array_shift(static::$group);
          array_pop(static::$prefix);
          if (empty(static::$prefix)) static::$prefix = [''];
        break;

      }

      return $group ?: new RouteGroup();
    }
289605
public function setNodeNsPrefix($prefix)
	{
		if (is_string($prefix) && strlen($prefix))
		{
			$this->nodeNsPrefix = rtrim($prefix, ':') . ':';
		}
		else
		{			
			$this->nodeNsPrefix = '';
		}
		
		return $this;
	}
667258
public function compileGroup($stub, $compiledRoutes, stdClass $scaffolderConfig)
    {
        $this->stub = $stub;

        $this->replaceRoutes($compiledRoutes)
            ->replacePrefix($scaffolderConfig->routing->prefix)
            ->store(null, $scaffolderConfig, $this->stub, new FileToCompile(null, null));

        return $this->stub;
    }
502104
public function group(string $prefix, callable $callback): RouteGroup
    {
        $prefix = ($prefix === '/') ? $this->prefix : rtrim($this->prefix, '/') . sprintf('/%s', ltrim($prefix, '/'));

        $group = $this->router->group($prefix, $callback);

        // in cases of group of groups, we need to persist the settings from the previous group in the new one.
        if ($host = $this->getHost()) {
            $group->setHost($host);
        }
        if ($scheme = $this->getScheme()) {
            $group->setScheme($scheme);
        }
        if ($port = $this->getPort()) {
            $group->setPort($port);
        }
        if ($strategy = $this->getStrategy()) {
            $group->setStrategy($strategy);
        }

        // merge all the previous group middlewares in this last group.
        $group->middleware(array_merge($this->getMiddlewareStack(), $group->getMiddlewareStack()));

        return $group;
    }
1256862
public function addPrefix($prefix)
	{
		if (!in_array($prefix, $this->prefixes))
		{
			array_push($this->prefixes, trim($prefix));
		}

		return $this;
	}
1235060
public function getNamespaceForPrefix( $prefix )
	{
		if ( ! isset( $this->instance_namespaces[ $prefix ] ) ) return null;
		return $this->instance_namespaces[ $prefix ];
	}
939852
public function group($prefix, callable $group)
    {
        $group = new RouteGroup($prefix, $group, $this);

        $this->groups[] = $group;

        return $group;
    }
1086652
private static function handleConfigNamespace(&$namespace, $prefix)
    {
        if ($prefix == "" && $namespace == "") {
            $namespace = "App\\Controllers";
            return;
        }

        if ($namespace == "") {
            $file = empty(self::$router_file) ? 'app/routers.php' : str_replace(['/', '\\'], DIRECTORY_SEPARATOR, self::$router_file);
            throw new \ErrorException("{$file}路由文件有错误！当指定路由前缀或模块化开发时，'namespace'不能为空");
        }
    }
1076743
public function removeNamespace( $prefix, $namespace )
	{
		if ( ! $this->hasNamespace( $prefix ) ) return false;
		unset( $this->namespaces[ $prefix ] );
		return true;
	}
787338
public function group(string $prefix, callable $handler) : RouterInterface {
        $this->setPrefix($prefix);
        $handler($this);
        $this->setPrefix('');
        return $this;
    }
98353
protected function replaceClassNameSingular(&$stub, $name)
    {
        $stub = str_replace(
            '[[DummyClassNameSingular]]', Str::singular($this->getNameInput()), $stub
        );

        return $this;
    }
142023
protected function replaceNamespace(&$stub, $name)
    {
        $stub = str_replace(
            'DummyNamespace', $this->getNamespace($name), $stub
        );

        $stub = str_replace(
            'DummyRootNamespace', $this->laravel->getNamespace().'Laravel\\', $stub
        );

        return $this;
    }
1249123
protected function replaceTableName(&$stub)
    {
        $table = $this->scaffoldCommandObj->getMeta()['table'];
        $stub = str_replace('{{table}}', $table, $stub);

        return $this;
    }
721097
protected function replaceClassName(&$stub)
    {
        $className = ucwords(camel_case($this->argumentName()));

        $stub = str_replace('{{class}}', $className, $stub);

        return $this;
    }