public function setSocket()
    {
        if (empty($this->uri['scheme'])) {
            throw new OutOfBoundsException('Unknown URL scheme');
        }

        if ($this->uri['scheme'] === 'http') {
            $port = 80;
            $protocol = 'tcp';
        } else if ($this->uri['scheme'] === 'https') {
            $port = 443;
            $protocol = 'ssl';
        } else {
            throw new UnexpectedValueException("Unsupported URL scheme: {$this->uri['scheme']}");
        }

        if (isset($this->uri['port'])) {
            $port = $this->uri['port'];
        }

        $this->socket = "$protocol://{$this->uri['host']}:$port";

        if (!isset($this->headers['Host'])) {
            $this->headers['Host'] = "{$this->uri['host']}:$port";
        }

        return $this;
    }
public function setSocket()
    {
        if (empty($this->uri['scheme'])) {
            throw new OutOfBoundsException('Unknown URL scheme');
        }

        if ($this->uri['scheme'] === 'http') {
            $port = 80;
            $protocol = 'tcp';
        } else if ($this->uri['scheme'] === 'https') {
            $port = 443;
            $protocol = 'ssl';
        } else {
            throw new UnexpectedValueException("Unsupported URL scheme: {$this->uri['scheme']}");
        }

        if (isset($this->uri['port'])) {
            $port = $this->uri['port'];
        }

        $this->socket = "$protocol://{$this->uri['host']}:$port";

        if (!isset($this->headers['Host'])) {
            $this->headers['Host'] = "{$this->uri['host']}:$port";
        }

        return $this;
    }
public function setSocket ( ) { if ( empty ( $ this -> uri [ 'scheme' ] ) ) { throw new OutOfBoundsException ( 'Unknown URL scheme' ) ; } if ( $ this -> uri [ 'scheme' ] === 'http' ) { $ port = 80 ; $ protocol = 'tcp' ; } else if ( $ this -> uri [ 'scheme' ] === 'https' ) { $ port = 443 ; $ protocol = 'ssl' ; } else { throw new UnexpectedValueException ( "Unsupported URL scheme: {$this->uri['scheme']}" ) ; } if ( isset ( $ this -> uri [ 'port' ] ) ) { $ port = $ this -> uri [ 'port' ] ; } $ this -> socket = "$protocol://{$this->uri['host']}:$port" ; if ( ! isset ( $ this -> headers [ 'Host' ] ) ) { $ this -> headers [ 'Host' ] = "{$this->uri['host']}:$port" ; } return $ this ; }
Sets a socket depending on the current URI parameters
@return $this
@throws OutOfBoundsException
@throws UnexpectedValueException
Sets a socket depending on the current URI parameters