protected $_href = '';
+ /**
+ * @var string
+ */
+ protected $_canonical = '';
+
/**
* @var array
*/
$this->_href = $href;
}
+ /**
+ * @return string
+ */
+ public function getCanonical(): string
+ {
+ return $this->_canonical;
+ }
+
+ /**
+ * @param string $canonical
+ */
+ public function setCanonical(string $canonical): void
+ {
+ $this->_canonical = $canonical;
+ }
+
+ public function getCanonicalURL(): string
+ {
+ $canonical = $this->getCanonical() || $this->getHref();
+ return $this->_getURL($canonical);
+ }
+
public function getURL()
+ {
+ return $this->_getURL($this->getHref());
+ }
+
+ protected function _getURL($href)
{
$domain = Locale::getMainDomain($this->getLocale(), $this->getVariant());
- $href = $this->getHref();
+
if ($href === 'home') {
$href = '';
}