FluxBB\Web\Router::getPath PHP Method

getPath() public method

public getPath ( $name, $parameters = [] )
    public function getPath($name, $parameters = [])
    {
        $parts = $this->reverse[$name];
        $path = implode('', array_map(function ($part) use($parameters) {
            if (is_array($part)) {
                $part = $parameters[$part[0]];
            }
            return $part;
        }, $parts));
        $path = '/' . ltrim($path, '/');
        return $path;
    }

Usage Example

Example #1
0
 public function toRoute($handler, $parameters = [])
 {
     $path = $this->router->getPath($handler, $parameters);
     return $this->getUrlToPath($path);
 }