Sulu\Component\Webspace\CustomUrl::setUrl PHP Method

setUrl() public method

Sets the url.
public setUrl ( string $url )
$url string
    public function setUrl($url)
    {
        $this->url = $url;
    }

Usage Example

Example #1
0
 /**
  * Generates the custom URLs from the XML document.
  *
  * A custom URL must contain at lease one *, which will be used as a placeholder.
  *
  * @param \DOMNode $environmentNode
  * @param Environment $environment
  *
  * @throws InvalidCustomUrlException
  */
 protected function generateCustomUrls(\DOMNode $environmentNode, Environment $environment)
 {
     foreach ($this->xpath->query('x:custom-urls/x:custom-url', $environmentNode) as $urlNode) {
         /** @var \DOMNode $urlNode */
         $url = new CustomUrl();
         $url->setUrl(rtrim($urlNode->nodeValue, '/'));
         if (false === strpos($url->getUrl(), '*')) {
             throw new InvalidCustomUrlException($this->webspace, $url->getUrl());
         }
         $environment->addCustomUrl($url);
     }
 }