src/Charcoal/Object/RoutableTrait.php
protected function generateRoutePattern($pattern)
    {
        if ($this instanceof ViewableInterface && $this->view() !== null) {
            $route = $this->view()->render($pattern, $this->viewController());
        } else {
            $route = preg_replace_callback('~\{\{\s*(.*?)\s*\}\}~i', [ $this, 'parseRouteToken' ], $pattern);
        }

        return $this->slugify($route);
    }
protected function generateRoutePattern($pattern)
    {
        if ($this instanceof ViewableInterface && $this->view() !== null) {
            $route = $this->view()->render($pattern, $this->viewController());
        } else {
            $route = preg_replace_callback('~\{\{\s*(.*?)\s*\}\}~i', [ $this, 'parseRouteToken' ], $pattern);
        }

        return $this->slugify($route);
    }
Generate a route from the given pattern.

@uses   self::parseRouteToken() If a view renderer is unavailable.
@param  string $pattern The slug pattern.
@return string Returns the generated route.