public static function url(string $name, ?array $parameters = [])
  {
    $url = null;

    foreach (Swish::$routes as $route) {
      if ($route['name'] == $name) {
        $url = $route['pattern'];

        if ($route['required'] > 0 && ($route['required'] == count($parameters))) {
          foreach ($parameters as $name => $parameter) {
            $url = str_replace('{' . $name . '}', $parameter, $url);
          }
        }
      }
    }

    if (str_contains($url, ['{', '}'])) $url = null;

    return $url;
  }
public static function url(string $name, ?array $parameters = [])
  {
    $url = null;

    foreach (Swish::$routes as $route) {
      if ($route['name'] == $name) {
        $url = $route['pattern'];

        if ($route['required'] > 0 && ($route['required'] == count($parameters))) {
          foreach ($parameters as $name => $parameter) {
            $url = str_replace('{' . $name . '}', $parameter, $url);
          }
        }
      }
    }

    if (str_contains($url, ['{', '}'])) $url = null;

    return $url;
  }
public static function url ( string $ name , ? array $ parameters = [ ] ) { $ url = null ; foreach ( Swish :: $ routes as $ route ) { if ( $ route [ 'name' ] == $ name ) { $ url = $ route [ 'pattern' ] ; if ( $ route [ 'required' ] > 0 && ( $ route [ 'required' ] == count ( $ parameters ) ) ) { foreach ( $ parameters as $ name => $ parameter ) { $ url = str_replace ( '{' . $ name . '}' , $ parameter , $ url ) ; } } } } if ( str_contains ( $ url , [ '{' , '}' ] ) ) $ url = null ; return $ url ; }
Generate url from route

@param string $name
@param null|array $parameters
@return string $url
Generate url from route