public static function parse_url($url): array
  {
    $url = self::cast($url);
    $r = x::merge_arrays(parse_url($url), ['url' => $url,'query' => '','params' => []]);
    if ( strpos($url,'?') > 0 )
    {
      $p = explode('?',$url);
      $r['url'] = $p[0];
      $r['query'] = $p[1];
      $ps = explode('&',$r['query']);
      foreach ( $ps as $p ){
        $px = explode('=',$p);
        $r['params'][$px[0]] = $px[1];
      }
    }
    return $r;
  }