Created
May 26, 2012 15:20
-
-
Save jonathanmaron/2794307 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace My\View\Helper; | |
use Zend\View\Helper\AbstractHelper; | |
class Uri extends AbstractHelper | |
{ | |
protected $request; | |
public function __invoke() | |
{ | |
$uri = new \StdClass(); | |
$uri->relative = $this->getRequest()->getRequestUri(); | |
$uri->absolute = $this->getRequest()->getUri(); | |
$uri->scheme = parse_url($uri->absolute, PHP_URL_SCHEME); | |
$uri->host = parse_url($uri->absolute, PHP_URL_HOST); | |
$uri->port = parse_url($uri->absolute, PHP_URL_PORT); | |
$uri->user = parse_url($uri->absolute, PHP_URL_USER); | |
$uri->password = parse_url($uri->absolute, PHP_URL_PASS); | |
$uri->path = parse_url($uri->absolute, PHP_URL_PATH); | |
$uri->query = parse_url($uri->absolute, PHP_URL_QUERY); | |
return $uri; | |
} | |
public function setRequest($request) | |
{ | |
$this->request = $request; | |
} | |
public function getRequest() | |
{ | |
return $this->request; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment