public function group()
    {
        // Get arguments
        if (func_num_args() === 2) {
            list($prefix, $routes) = func_get_args();
            $filter = null;
        } elseif (func_num_args() === 3) {
            list($filter, $prefix, $routes) = func_get_args();
        }

        // Add leading slash to prefix if not present
        if (strncmp($prefix, '/', 1) !== 0) {
            $prefix = '/' . $prefix;
        }

        // Add trailing slash to prefix if not present
        if (substr($prefix, -1) !== '/') {
            $prefix .= '/';
        }

        // Register routes
        foreach ($routes as $route) {
            $type = $route[0];
            if ($type === 'resource') {
                $this->resource($prefix . $route[1], $route[2], $filter);
            } else {
                $this->register($type, $prefix . $route[1], $route[2], $filter);
            }
        }
    }
public function group()
    {
        // Get arguments
        if (func_num_args() === 2) {
            list($prefix, $routes) = func_get_args();
            $filter = null;
        } elseif (func_num_args() === 3) {
            list($filter, $prefix, $routes) = func_get_args();
        }

        // Add leading slash to prefix if not present
        if (strncmp($prefix, '/', 1) !== 0) {
            $prefix = '/' . $prefix;
        }

        // Add trailing slash to prefix if not present
        if (substr($prefix, -1) !== '/') {
            $prefix .= '/';
        }

        // Register routes
        foreach ($routes as $route) {
            $type = $route[0];
            if ($type === 'resource') {
                $this->resource($prefix . $route[1], $route[2], $filter);
            } else {
                $this->register($type, $prefix . $route[1], $route[2], $filter);
            }
        }
    }
public function group ( ) { // Get arguments if ( func_num_args ( ) === 2 ) { list ( $ prefix , $ routes ) = func_get_args ( ) ; $ filter = null ; } elseif ( func_num_args ( ) === 3 ) { list ( $ filter , $ prefix , $ routes ) = func_get_args ( ) ; } // Add leading slash to prefix if not present if ( strncmp ( $ prefix , '/' , 1 ) !== 0 ) { $ prefix = '/' . $ prefix ; } // Add trailing slash to prefix if not present if ( substr ( $ prefix , - 1 ) !== '/' ) { $ prefix .= '/' ; } // Register routes foreach ( $ routes as $ route ) { $ type = $ route [ 0 ] ; if ( $ type === 'resource' ) { $ this -> resource ( $ prefix . $ route [ 1 ] , $ route [ 2 ] , $ filter ) ; } else { $ this -> register ( $ type , $ prefix . $ route [ 1 ] , $ route [ 2 ] , $ filter ) ; } } }
Register a group of routers with a common filter

@param string $filter Filter name
@param string $prefix Prefix for all routes
@param array $routers Routes
Register a group of routers with a common filter