/** * Return the URI for this header * * @return string */ public function getUri() { if ($this->uri instanceof UriInterface) { return $this->uri->toString(); } return $this->uri; }
/** * @param string|ZendUriInterface|null $uri */ public function __construct($uri = null) { $this->setScheme('data'); $this->setEncoding('base64'); if ($uri instanceof self) { $this->setMimeType($uri->getMimeType()); $this->setEncoding($uri->getEncoding()); $this->setRawData($uri->getRawData()); } elseif (is_string($uri)) { $this->parse($uri); } elseif ($uri instanceof ZendUriInterface) { $this->parse($uri->toString()); } elseif ($uri !== null) { throw new InvalidArgumentException(sprintf('Expecting a string or a URI object, received "%s"', is_object($uri) ? get_class($uri) : gettype($uri))); } }
/** * Get uri for locale * * @param string $locale * * @return string */ public function getUrlForLocale($locale) { $alias = $this->getAliasFromLocale($locale); $path = $this->uri->getPath(); $pathParts = explode('/', $path); array_splice($pathParts, 1, 0, $alias); $path = rtrim(implode('/', $pathParts), '/'); return $path; }