src/Browser/BrowserConfigurationTrait.php
public function setProxy($proxy)
  {
    $args = array('set_proxy');
    if ($proxy !== false)
    {
      if (preg_match('~^(http|socks5)://(?:([^:@/]*?):([^:@/]*?)@)?([^:@/]+):(\d+)$~', $proxy, $components))
      {
        array_push($args, $components[4], intval($components[5], 10), $components[1]);
        if (strlen($components[2]) || strlen($components[3]))
        {
          array_push($args, urldecode($components[2]), urldecode($components[3]));
        }
      }
      else
      {
        throw new \UnexpectedValueException('Invalid proxy url ' . $proxy);
      }
    }
    return call_user_func_array(array($this, 'command'), $args);
  }
public function setProxy($proxy)
  {
    $args = array('set_proxy');
    if ($proxy !== false)
    {
      if (preg_match('~^(http|socks5)://(?:([^:@/]*?):([^:@/]*?)@)?([^:@/]+):(\d+)$~', $proxy, $components))
      {
        array_push($args, $components[4], intval($components[5], 10), $components[1]);
        if (strlen($components[2]) || strlen($components[3]))
        {
          array_push($args, urldecode($components[2]), urldecode($components[3]));
        }
      }
      else
      {
        throw new \UnexpectedValueException('Invalid proxy url ' . $proxy);
      }
    }
    return call_user_func_array(array($this, 'command'), $args);
  }
Sets or unsets web proxy.

@param string|false $proxy proxy url formatted as '(http|socks5)://[username:password@]host:port', or false to unset
@return bool
@throws \UnexpectedValueException when the proxy url is invalid