public static function prefix($name, $params = [], $callback = null)
    {
        if ($callback === null) {
            $callback = $params;
            $params = [];
        }
        $name = Inflector::underscore($name);

        if (empty($params['path'])) {
            $path = '/' . $name;
        } else {
            $path = $params['path'];
            unset($params['path']);
        }

        $params = array_merge($params, ['prefix' => $name]);
        static::scope($path, $params, $callback);
    }
public static function prefix($name, $params = [], $callback = null)
    {
        if ($callback === null) {
            $callback = $params;
            $params = [];
        }
        $name = Inflector::underscore($name);

        if (empty($params['path'])) {
            $path = '/' . $name;
        } else {
            $path = $params['path'];
            unset($params['path']);
        }

        $params = array_merge($params, ['prefix' => $name]);
        static::scope($path, $params, $callback);
    }
public static function prefix ( $ name , $ params = [ ] , $ callback = null ) { if ( $ callback === null ) { $ callback = $ params ; $ params = [ ] ; } $ name = Inflector :: underscore ( $ name ) ; if ( empty ( $ params [ 'path' ] ) ) { $ path = '/' . $ name ; } else { $ path = $ params [ 'path' ] ; unset ( $ params [ 'path' ] ) ; } $ params = array_merge ( $ params , [ 'prefix' => $ name ] ) ; static :: scope ( $ path , $ params , $ callback ) ; }
Create prefixed routes.

This method creates a scoped route collection that includes
relevant prefix information.

The path parameter is used to generate the routing parameter name.
For example a path of `admin` would result in `'prefix' => 'admin'` being
applied to all connected routes.

The prefix name will be inflected to the underscore version to create
the routing path. If you want a custom path name, use the `path` option.

You can re-open a prefix as many times as necessary, as well as nest prefixes.
Nested prefixes will result in prefix values like `admin/api` which translates
to the `Controller\Admin\Api\` namespace.

@param string $name The prefix name to use.
@param array|callable $params An array of routing defaults to add to each connected route.
If you have no parameters, this argument can be a callable.
@param callable|null $callback The callback to invoke that builds the prefixed routes.
@return void
Create prefixed routes .