for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace MinasRouter\Router;
use MinasRouter\Router\RouteCollection;
use MinasRouter\Router\Middlewares\MiddlewareCollection;
class RouteGroups
{
/** @var string */
public $name;
public $prefix;
public $namespace;
/** @var object */
public $middlewares;
protected $collection;
public function __construct(RouteCollection $collection)
$this->collection = $collection;
}
/**
* Set a namespace for the group.
*
* @return \MinasRouter\Router\RouteGroups
*/
public function namespace($namespace): RouteGroups
$this->namespace = $namespace;
return $this;
* Set a prefix for the group.
public function prefix($prefix): RouteGroups
$this->prefix = $prefix;
* Set a name for the group.
public function name($name): RouteGroups
$this->name = $name;
* Set a middlewares for the group.
public function middlewares($middlewares): RouteGroups
$this->middlewares = new MiddlewareCollection($middlewares);
public function group(\Closure $routeGroups)
call_user_func($routeGroups);
return $this->collection->defineGroup();