src/Net/Url.php
public function parse($url)
  {
    $parts = $this->_parse_url($url);

    foreach(array('user', 'pass', 'fragment') as $part)
      if(isset($parts[$part]))
        $parts[$part] = urldecode($parts[$part]);

    if(isset($parts['host']))
      $parts['host'] = idn_to_utf8($parts['host']);

    if(isset($parts['path']))
      $parts['path'] = rawurldecode(str_ireplace('%2F', '%252F', $parts['path']));

    return $this->setParts($parts);
  }
public function parse($url)
  {
    $parts = $this->_parse_url($url);

    foreach(array('user', 'pass', 'fragment') as $part)
      if(isset($parts[$part]))
        $parts[$part] = urldecode($parts[$part]);

    if(isset($parts['host']))
      $parts['host'] = idn_to_utf8($parts['host']);

    if(isset($parts['path']))
      $parts['path'] = rawurldecode(str_ireplace('%2F', '%252F', $parts['path']));

    return $this->setParts($parts);
  }
Parse an URL into replacement parts and create a new class instance using them

Takes apart the `$url` and uses its parts to call {@see \AnrDaemon\Net\Url::setParts() self::setParts()}.

The user, password and fragment fields are url-decoded.

The IDN hostnames are decoded.

The path is url-decoded, except for encoded "/"(%2F) character.

The query string is decoded into an array by the extension of using
{@see \AnrDaemon\Net\Url::setParts() self::setParts()} to compose a new class instance.

Note: May not parse all URL's in a desirable way.
See f.e. https://3v4l.org/BPsaa for mailto: URI's

@see https://tools.ietf.org/html/rfc3986 [RFC3986]
@see \parse_url()
@see \parse_str()

@uses \AnrDaemon\Net\Url::setParts() to construct resulting object.

@param string $url An URL to parse.
@return Url A new class instance with corresponding parts replaced.