/** * Normalize the base signature URL * * @param string $url * @return string */ public function normaliseBaseSignatureUrl($url) { $uri = new \Zend\URI\URL($url); if ($uri->getScheme() == 'http' && $uri->getPort() == '80') { $uri->setPort(''); } elseif ($uri->getScheme() == 'https' && $uri->getPort() == '443') { $uri->setPort(''); } elseif (!in_array($uri->getScheme(), array('http', 'https'))) { throw new OAuthException('Invalid URL provided; must be an HTTP or HTTPS scheme'); } $uri->setQuery(''); $uri->setFragment(''); $uri->setHost(strtolower($uri->getHost())); return $uri->generate(); }
public function __construct($uri = null) { if (null === $uri) { $uri = 'http://localhost/foo/bar/baz/2'; } //$uri = \Zend\URI\URL::fromString($uri); $url = new \Zend\URI\URL($uri); $this->_host = $url->getHost(); $this->_port = $url->getPort(); parent::__construct($url); }