This method should implement a protocol
setter which will be used to determine
which Protocol is used in the Base URL.

@param  string $protocol
@return \NEM\Contracts\HttpHandler
546612
public function setProtocol($protocol)
    {
        $lowerProtocol = strtolower($protocol);

        // handle special cases where protocol is not
        // formatted as intended yet.

        if ("websocket" == $lowerProtocol)
            $lowerProtocol = "ws";

        if (in_array($lowerProtocol, ["https", "wss"])) {
            // provided secure type of protocol
            $this->setUseSsl(true);
            $lowerProtocol = substr($lowerProtocol, 0, -1);
        }

        $this->protocol = $lowerProtocol;
        return $this;
    }
909959
public static function stripProtocol($url, $protocols = ['http', 'https']) {
		$pieces = parse_url($url);
		// Already stripped?
		if (empty($pieces['scheme'])) {
			return $url;
		}
		if ($protocols && !in_array($pieces['scheme'], $protocols)) {
			return $url;
		}

		return mb_substr($url, mb_strlen($pieces['scheme']) + 3);
	}
59897
protected function protocolWithActiveSsl($protocol) : bool
  {
      $protocol = strtolower((string)$protocol);
      return in_array($protocol, ['on', '1', 'https', 'ssl'], true);
  }
1355288
public function withProtocolVersion($version)
    {
        Validator::checkProtocolVersion($version);
        $instance = clone $this;
        $instance->protocol = $version;

        return $instance;
    }
1082955
public function setRequestHandler($handler)
    {
        $this->requestHandler = $handler;

        $this->requestHandler->setUri($this->url)
            ->setMethod($this->method);

        $this->requestHandler->getUri()->setPort($this->port);

        return $this;
    }
852915
public function unregisterStream($protocol)
    {
        if (isset(self::$streams[$protocol])) {
            $result = stream_wrapper_unregister($protocol);
            if ($result === true) {
                unset(self::$streams[$protocol]);
            }
        }

        return $this;
    }
937596
public function create($url)
        {
            // If no a protocol in URL, assume its a Laravel link
            if ( ! preg_match('!^\w+://! i', $url)) {
                $url = url($url);
            }

            $this->url = $url;
            $this->session = curl_init($this->url);

            return $this;
        }
409080
public static function resolve_url($url)
    {
        // prepend protocol://hostname:port
        if (!preg_match('|^https?://|', $url)) {
            $schema       = 'http';
            $default_port = 80;

            if (self::https_check()) {
                $schema       = 'https';
                $default_port = 443;
            }

            $prefix = $schema . '://' . preg_replace('/:\d+$/', '', $_SERVER['HTTP_HOST']);
            if ($_SERVER['SERVER_PORT'] != $default_port) {
                $prefix .= ':' . $_SERVER['SERVER_PORT'];
            }

            $url = $prefix . ($url[0] == '/' ? '' : '/') . $url;
        }

        return $url;
    }
372394
public function Protocol($Value = NULL) {
      if (!is_null($Value) && in_array($Value, array('http', 'https')))
         $this->_Protocol = $Value;
         
      return $this->_Protocol;
   }
1339880
public function setUrl($url) {
        if (!is_string($url)) throw new IllegalTypeException('Illegal type of parameter $url: '.gettype($url));

        // TODO: validate URL

        if (strpos($url, ' ') !== false)
            throw new InvalidArgumentException('Invalid argument $url: '.$url);

        $this->url = $url;
        return $this;
    }
629603
public function setProtocol( string $name, string $separator = '://' ) : VfsHandler
   {

      $this->_protocolName = $name ?? '';
      $this->_protocolSeparator = $separator ?? '';

      return $this;

   }
241304
public static function unregister($protocol)
  {
    $wrappers = stream_get_wrappers();
    if (!in_array($protocol, $wrappers)) {
      throw new Wrapper_Exception(
        "Protocol '$protocol' has not been registered yet"
      );
    }

    return stream_wrapper_unregister($protocol);
  }
1163499
private function setUrl(?string $url): self
    {
        $this->updatePropertyValue(
            UrlFieldInterface::PROP_URL,
            $url
        );

        return $this;
    }
668553
public function setDelegate($delegate)
    {
        if (!$delegate instanceof KTranslatorInterface) {
            throw new InvalidArgumentException('Delegate: '.get_class($delegate).' does not implement KTranslatorInterface');
        }

        return parent::setDelegate($delegate);
    }
269858
public static function notFound(string $uri, string $protocol = Protocol::HTTP): self
    {
        return new static(sprintf('Not Found: %s', $uri), $protocol, 404);
    }
648945
public function setMethod($method)
	{
		$method = strtoupper($method);
		
		if(!preg_match("'^[A-Z]{2,}$'", $method))
		{
			throw new \InvalidArgumentException(sprintf('Invalid HTTP request method: "%s"', $method));
		}
		
		$this->method = $method;

		return $this;
	}
785140
public static function replenishProtocol($url, $protocol = '')
    {
        // Let's trim the url
        if (is_string($url)) {
            $url = trim($url);
        }

        /*
         * Url is not provided?
         * Nothing to do
         */
        if (empty($url)) {
            return '';
        }

        /*
         * It's a valid url?
         * Let's return it
         */
        if (Regex::isValidUrl($url, true)) {
            return $url;
        }

        // Protocol is not provided?
        if (empty($protocol)) {
            $protocol = self::getProtocolName();
        }

        return sprintf('%s://%s', $protocol, $url);
    }