public function getPort()
    {
        if (null !== $this->port) {
            return $this->port;
        }

        $tmp = parse_url($this->getUrl());
        if (isset($tmp['port'])) {
            $this->setPort($tmp['port']);
        } elseif (isset($tmp['scheme'])) {
            $this->setPort(self::$defaultPorts[$tmp['scheme']]);
        }

        return $this->port;
    }
public function getPort()
    {
        if (null !== $this->port) {
            return $this->port;
        }

        $tmp = parse_url($this->getUrl());
        if (isset($tmp['port'])) {
            $this->setPort($tmp['port']);
        } elseif (isset($tmp['scheme'])) {
            $this->setPort(self::$defaultPorts[$tmp['scheme']]);
        }

        return $this->port;
    }
public function getPort ( ) { if ( null !== $ this -> port ) { return $ this -> port ; } $ tmp = parse_url ( $ this -> getUrl ( ) ) ; if ( isset ( $ tmp [ 'port' ] ) ) { $ this -> setPort ( $ tmp [ 'port' ] ) ; } elseif ( isset ( $ tmp [ 'scheme' ] ) ) { $ this -> setPort ( self :: $ defaultPorts [ $ tmp [ 'scheme' ] ] ) ; } return $ this -> port ; }
Returns the port of the current connection,
if not set, it will try to guess the port
from the url of the client.

@return int the port number
Returns the port of the current connection if not set it will try to guess the port from the url of the client .